diff --git a/go.mod b/go.mod index 91f42f1013c8af3c387e48c6d0f4e3926410852a..89dbe76dc03b05f0061c18a67a3463c7994a9550 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/charmbracelet/crush go 1.25.0 require ( - charm.land/fantasy v0.0.0 + charm.land/fantasy v0.1.0 github.com/JohannesKaufmann/html-to-markdown v1.6.0 github.com/MakeNowJust/heredoc v1.0.0 github.com/PuerkitoBio/goquery v1.10.3 @@ -50,8 +50,6 @@ require ( mvdan.cc/sh/v3 v3.12.1-0.20250902163504-3cf4fd5717a5 ) -replace charm.land/fantasy => ../fantasy - require ( cloud.google.com/go v0.116.0 // indirect cloud.google.com/go/auth v0.17.0 // indirect diff --git a/go.sum b/go.sum index 5981cabbb202a1d0a01462ccfed7a753e474ed0c..6549bff57021136c62083d132a6b2abc8a87b476 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +charm.land/fantasy v0.1.0 h1:F+k1zmmqMllM/VpVFy+BY6lDmE0SsJ3LUWGQm+o20Bg= +charm.land/fantasy v0.1.0/go.mod h1:lR8tV9VQlH/HOHs9ilSzBkcN9I+o639jpVPs4MI/Jyk= cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE= cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= cloud.google.com/go/auth v0.17.0 h1:74yCm7hCj2rUyyAocqnFzsAYXgJhrG26XCFimrc/Kz4= diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index db691c9c7d5761d84fddc6a2a2cfcb7039c1707d..3719a1150901e621b7998a9f1e7be0a2aa3ef4b8 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -209,7 +209,7 @@ func TestCoderAgent(t *testing.T) { require.NoError(t, err) res, err := agent.Run(t.Context(), SessionAgentCall{ - Prompt: "download the file from https://httpbin.org/robots.txt and save it as robots.txt", + Prompt: "download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt", SessionID: session.ID, MaxOutputTokens: 10000, }) @@ -241,9 +241,9 @@ func TestCoderAgent(t *testing.T) { require.True(t, foundDownload, "Expected to find a download operation") - robotsPath := filepath.Join(env.workingDir, "robots.txt") - _, err = os.Stat(robotsPath) - require.NoError(t, err, "Expected robots.txt file to exist") + examplePath := filepath.Join(env.workingDir, "example.txt") + _, err = os.Stat(examplePath) + require.NoError(t, err, "Expected example.txt file to exist") }) t.Run("fetch tool", func(t *testing.T) { agent, env := setupAgent(t, pair) @@ -252,7 +252,7 @@ func TestCoderAgent(t *testing.T) { require.NoError(t, err) res, err := agent.Run(t.Context(), SessionAgentCall{ - Prompt: "fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'", + Prompt: "fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'", SessionID: session.ID, MaxOutputTokens: 10000, }) diff --git a/internal/agent/common_test.go b/internal/agent/common_test.go index 7e1bd5920c5d21d3d67fb7cbeab77f2cd446790d..e1446a22ea8ade3efc94fa247841e7268be8cc55 100644 --- a/internal/agent/common_test.go +++ b/internal/agent/common_test.go @@ -1,6 +1,7 @@ package agent import ( + "context" "net/http" "os" "path/filepath" @@ -163,7 +164,7 @@ func coderAgent(r *recorder.Recorder, env env, large, small fantasy.LanguageMode return nil, err } - systemPrompt, err := prompt.Build(large.Provider(), large.Model(), *cfg) + systemPrompt, err := prompt.Build(context.TODO(), large.Provider(), large.Model(), *cfg) if err != nil { return nil, err } diff --git a/internal/agent/coordinator.go b/internal/agent/coordinator.go index 4925666a9bdf9b9c164cbe0d8dc0ef1fa0346093..ebfd3923c1e18b83a3b86357551f4cd2d26cee0f 100644 --- a/internal/agent/coordinator.go +++ b/internal/agent/coordinator.go @@ -270,7 +270,7 @@ func (c *coordinator) buildAgent(ctx context.Context, prompt *prompt.Prompt, age return nil, err } - systemPrompt, err := prompt.Build(large.Model.Provider(), large.Model.Model(), *c.cfg) + systemPrompt, err := prompt.Build(ctx, large.Model.Provider(), large.Model.Model(), *c.cfg) if err != nil { return nil, err } diff --git a/internal/agent/prompt/prompt.go b/internal/agent/prompt/prompt.go index b800194f31eee118694c3a9e407d0f520c432e0a..efbe78665915831262223f644854bf630c67be34 100644 --- a/internal/agent/prompt/prompt.go +++ b/internal/agent/prompt/prompt.go @@ -1,6 +1,7 @@ package prompt import ( + "context" "fmt" "os" "path/filepath" @@ -11,6 +12,7 @@ import ( "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/home" + "github.com/charmbracelet/crush/internal/shell" ) // Prompt represents a template-based prompt generator. @@ -30,6 +32,7 @@ type PromptDat struct { IsGitRepo bool Platform string Date string + GitStatus string ContextFiles []ContextFile } @@ -70,13 +73,17 @@ func NewPrompt(name, promptTemplate string, opts ...Option) (*Prompt, error) { return p, nil } -func (p *Prompt) Build(provider, model string, cfg config.Config) (string, error) { +func (p *Prompt) Build(ctx context.Context, provider, model string, cfg config.Config) (string, error) { t, err := template.New(p.name).Parse(p.template) if err != nil { return "", fmt.Errorf("parsing template: %w", err) } var sb strings.Builder - if err := t.Execute(&sb, p.promptData(provider, model, cfg)); err != nil { + d, err := p.promptData(ctx, provider, model, cfg) + if err != nil { + return "", err + } + if err := t.Execute(&sb, d); err != nil { return "", fmt.Errorf("executing template: %w", err) } @@ -138,7 +145,7 @@ func expandPath(path string, cfg config.Config) string { return path } -func (p *Prompt) promptData(provider, model string, cfg config.Config) PromptDat { +func (p *Prompt) promptData(ctx context.Context, provider, model string, cfg config.Config) (PromptDat, error) { workingDir := cfg.WorkingDir() if p.workingDir != "" { workingDir = p.workingDir @@ -160,20 +167,28 @@ func (p *Prompt) promptData(provider, model string, cfg config.Config) PromptDat files[pathKey] = content } + isGit := isGitRepo(cfg.WorkingDir()) data := PromptDat{ Provider: provider, Model: model, Config: cfg, WorkingDir: workingDir, - IsGitRepo: isGitRepo(cfg.WorkingDir()), + IsGitRepo: isGit, Platform: platform, Date: p.now().Format("1/2/2006"), } + if isGit { + var err error + data.GitStatus, err = getGitStatus(ctx, cfg.WorkingDir()) + if err != nil { + return PromptDat{}, err + } + } for _, contextFiles := range files { data.ContextFiles = append(data.ContextFiles, contextFiles...) } - return data + return data, nil } func isGitRepo(dir string) bool { @@ -181,6 +196,58 @@ func isGitRepo(dir string) bool { return err == nil } +func getGitStatus(ctx context.Context, dir string) (string, error) { + sh := shell.NewShell(&shell.Options{ + WorkingDir: dir, + }) + branch, err := getGitBranch(ctx, sh) + if err != nil { + return "", err + } + status, err := getGitStatusSummary(ctx, sh) + if err != nil { + return "", err + } + commits, err := getGitRecentCommits(ctx, sh) + if err != nil { + return "", err + } + return branch + status + commits, nil +} + +func getGitBranch(ctx context.Context, sh *shell.Shell) (string, error) { + out, _, err := sh.Exec(ctx, "git branch --show-current 2>/dev/null") + if err != nil { + return "", nil + } + out = strings.TrimSpace(out) + if out == "" { + return "", nil + } + return fmt.Sprintf("Current branch: %s\n", out), nil +} + +func getGitStatusSummary(ctx context.Context, sh *shell.Shell) (string, error) { + out, _, err := sh.Exec(ctx, "git status --short 2>/dev/null | head -20") + if err != nil { + return "", nil + } + out = strings.TrimSpace(out) + if out == "" { + return "Status: clean\n", nil + } + return fmt.Sprintf("Status:\n%s\n", out), nil +} + +func getGitRecentCommits(ctx context.Context, sh *shell.Shell) (string, error) { + out, _, err := sh.Exec(ctx, "git log --oneline -n 3 2>/dev/null") + if err != nil || out == "" { + return "", nil + } + out = strings.TrimSpace(out) + return fmt.Sprintf("Recent commits:\n%s\n", out), nil +} + func (p *Prompt) Name() string { return p.name } diff --git a/internal/agent/templates/coder.md.tpl b/internal/agent/templates/coder.md.tpl index 2b78e70e0009b16267f308db2a45e2fa5b02eca1..52747ae88af7bd97ece3fbadeb4c604b2afed92f 100644 --- a/internal/agent/templates/coder.md.tpl +++ b/internal/agent/templates/coder.md.tpl @@ -10,7 +10,11 @@ These rules override everything else. Follow them strictly: 5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace 6. **NEVER COMMIT**: Unless user explicitly says "commit" 7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them. -8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so +8. **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. +9. **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. +10. **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. +11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user. +12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks. @@ -36,8 +40,17 @@ assistant: src/foo.c user: add error handling to the login function assistant: [searches for login, reads file, edits with exact match, runs tests] Done + +user: Where are errors from the client handled? +assistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712. + +When referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate: +- Example: "The error is handled in src/main.go:45" +- Example: "See the implementation in pkg/utils/helper.go:123-145" + + For every task, follow this sequence internally (don't narrate it): @@ -46,6 +59,7 @@ For every task, follow this sequence internally (don't narrate it): - Read files to understand current state - Check memory for stored commands - Identify what needs to change +- Use `git log` and `git blame` for additional context when needed **While acting**: - Read entire file before editing it @@ -53,6 +67,8 @@ For every task, follow this sequence internally (don't narrate it): - Make one logical change at a time - After each change: run tests - If tests fail: fix immediately +- Keep going until query is completely resolved before yielding to user +- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals **Before finishing**: - Run lint/typecheck if in memory @@ -64,6 +80,8 @@ For every task, follow this sequence internally (don't narrate it): - Follow existing patterns (check similar files) - If stuck, try different approach (don't repeat failures) - Make decisions yourself (search first, don't ask) +- Fix problems at root cause, not surface-level patches +- Don't fix unrelated bugs or broken tests (mention them in final message if relevant) @@ -98,6 +116,10 @@ When using edit tools: 4. Verify edit succeeded 5. Run tests +Efficiency tips: +- Don't re-read files after successful edits (tool will fail if it didn't work) +- Same applies for making folders, deleting files, etc. + Common mistakes to avoid: - Editing without reading first - Approximate text matches @@ -137,25 +159,48 @@ Before writing code: 3. Match existing style 4. Use same libraries/frameworks 5. Follow security best practices (never log secrets) +6. Don't use one-letter variable names unless requested Never assume libraries are available - verify first. + +**Ambition vs. precision**: +- New projects → be creative and ambitious with implementation +- Existing codebases → be surgical and precise, respect surrounding code +- Don't change filenames or variables unnecessarily +- Don't add formatters/linters/tests to codebases that don't have them After significant changes: +- Start testing as specific as possible to code changed, then broaden to build confidence +- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions - Run relevant test suite - If tests fail, fix before continuing - Check memory for test commands -- Run lint/typecheck if available +- Run lint/typecheck if available (on precise targets when possible) +- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue - Suggest adding commands to memory if not found +- Don't fix unrelated bugs or test failures (not your responsibility) - Search before assuming - Read files before editing +- Always use absolute paths for file operations (editing, reading, writing) - Use Agent tool for complex searches - Run tools in parallel when safe (no dependencies) +- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution - Summarize tool output for user (they don't see it) + + +When running non-trivial bash commands (especially those that modify the system): +- Briefly explain what the command does and why you're running it +- This ensures the user understands potentially dangerous operations +- Simple read-only commands (ls, cat, etc.) don't need explanation +- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`) +- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`) +- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`) + @@ -166,11 +211,45 @@ Balance autonomy with user intent: - Don't surprise user with unexpected actions + +Adapt verbosity to match the work completed: + +**Default (under 4 lines)**: +- Simple questions or single-file changes +- Casual conversation, greetings, acknowledgements +- One-word answers when possible + +**More detail allowed (up to 10-15 lines)**: +- Large multi-file changes that need walkthrough +- Complex refactoring where rationale adds value +- Tasks where understanding the approach is important +- When mentioning unrelated bugs/issues found +- Suggesting logical next steps user might want + +**What to include in verbose answers**: +- Brief summary of what was done and why +- Key files/functions changed (with `file:line` references) +- Any important decisions or tradeoffs made +- Next steps or things user should verify +- Issues found but not fixed + +**What to avoid**: +- Don't show full file contents unless explicitly asked +- Don't explain how to save files or copy code (user has access to your work) +- Don't use "Here's what I did" or "Let me know if..." style preambles/postambles +- Keep tone direct and factual, like handing off work to a teammate + + Working directory: {{.WorkingDir}} Is directory a git repo: {{if .IsGitRepo}}yes{{else}}no{{end}} Platform: {{.Platform}} Today's date: {{.Date}} +{{if .GitStatus}} + +Git status (snapshot at conversation start - may be outdated): +{{.GitStatus}} +{{end}} {{if gt (len .Config.LSP) 0}} diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml index 3335ed777be25141722cd71aadcfd1c29f30756f..ab6149e0ba0fe8da4818dae035a89be34f228b34 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01Qns4bhGsHTJigK4SYz1ND9","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":147,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01VSvk8MrHTkSrEnvCpQJk8e","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":147,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Bash File"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Create"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Creation"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Bash File"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Comman"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" with"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Hello Message"} } event: content_block_stop data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":147,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":8} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":147,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 861.204083ms + duration: 721.761417ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31156 + content_length: 35702 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,85 +84,82 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01LD78rchPCB51cQpGurtYoJ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1716,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1716,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_013jLr2AayoEQQnCHc4T354R","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2774,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2774,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01FWkL4iH4i6owfcGsk4Z29y","name":"bash","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01HqZFHzX8yiApMfMQmJWgE6","name":"bash","input":{}} } event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"com"}} - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mand\": \"ec"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"command\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ho 'hello "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"ech"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"bash' > te"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o 'hello bas"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"st"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h' > test."}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".txt\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"txt\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"d"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"descripti"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"es"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"on\": \"Create"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"cription\":"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" te"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \"Create "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"st.t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"test.t"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"xt w"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"xt wit"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ith conte"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h con"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nt"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tent 'h"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" 'hello ba"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ello bash'"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"sh"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"'\"}"} } event: content_block_stop data: {"type":"content_block_stop","index":0} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1716,"cache_read_input_tokens":6852,"output_tokens":87} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2774,"cache_read_input_tokens":6852,"output_tokens":87} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop"} headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.2726605s + duration: 2.315826375s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31557 + content_length: 36103 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01FWkL4iH4i6owfcGsk4Z29y\",\"input\":{\"command\":\"echo 'hello bash' \\u003e test.txt\",\"description\":\"Create test.txt with content 'hello bash'\"},\"name\":\"bash\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01FWkL4iH4i6owfcGsk4Z29y\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"no output\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01HqZFHzX8yiApMfMQmJWgE6\",\"input\":{\"command\":\"echo 'hello bash' \\u003e test.txt\",\"description\":\"Create test.txt with content 'hello bash'\"},\"name\":\"bash\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01HqZFHzX8yiApMfMQmJWgE6\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"no output\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -179,26 +176,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01GwkeutdSvaJFY2dhVh6Znj","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":99,"cache_read_input_tokens":8568,"cache_creation":{"ephemeral_5m_input_tokens":99,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_019FzYocE465Q6NhYPmjm2VC","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":99,"cache_read_input_tokens":9626,"cache_creation":{"ephemeral_5m_input_tokens":99,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":99,"cache_read_input_tokens":8568,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":99,"cache_read_input_tokens":9626,"output_tokens":4} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.283322125s + duration: 2.2299835s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml index 9d53ee41dedc04c91332c462bc90fd3fbf3e879a..c2c64d78c4d7576ca8d7e78dbcadf16f13c301e3 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 787 + content_length: 823 host: "" - body: '{"max_tokens":40,"messages":[{"content":[{"text":"Generate a concise title for the following content:\n\ndownload the file from https://httpbin.org/robots.txt and save it as robots.txt\n \u003cthink\u003e\n\n\u003c/think\u003e","type":"text"}],"role":"user"}],"model":"claude-3-5-haiku-20241022","system":[{"text":"you will generate a short title based on the first message a user begins a conversation with\n\n\u003crules\u003e\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\u003c/rules\u003e\n\n /no_think","type":"text"}],"stream":true}' + body: '{"max_tokens":40,"messages":[{"content":[{"text":"Generate a concise title for the following content:\n\ndownload the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\n \u003cthink\u003e\n\n\u003c/think\u003e","type":"text"}],"role":"user"}],"model":"claude-3-5-haiku-20241022","system":[{"text":"you will generate a short title based on the first message a user begins a conversation with\n\n\u003crules\u003e\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\u003c/rules\u003e\n\n /no_think","type":"text"}],"stream":true}' headers: Accept: - application/json @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01YE4hcHSKgePa9XeDaDHHc3","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":151,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01ULeTtfwnFfY2gtw8Cfxzhu","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":160,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Downloa"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Downloa"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Robots.txt from HTTP"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Example"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"B"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Text"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"in"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" File"} } event: content_block_stop - data: {"type":"content_block_stop","index":0} + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":151,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":12} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":160,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 661.353334ms + duration: 1.064168292s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31173 + content_length: 35755 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,96 +84,167 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01WRwMaD88XudHFovT9JisXa","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1720,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1720,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01BJkYB14puFkrdw46npBnh8","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":9639,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_011NZBWVRQ4Xh8eyVoJ3nkgq","name":"download","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01Pq3udBQnifHqpVC9LQkshK","name":"download","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"ur"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"url\": \"h"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"l\": \"h"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ttp"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tt"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"s://exam"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ps://httpbi"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ple"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n.org/robots"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"-f"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".txt"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"iles"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".on"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"file_path"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"line-convert"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \"rob"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".com/docu"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ot"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ment/txt"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"s.txt\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/e"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"xa"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mple.txt\""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"file_pa"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"th\": \"/t"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mp/crush-"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"test/Test"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"CoderAg"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ent/ant"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"hropic-so"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nn"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"et/downloa"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"d_to"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ol"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/exa"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mpl"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e.tx"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1720,"cache_read_input_tokens":6852,"output_tokens":81} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":9639,"output_tokens":112} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop"} headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.24605475s + duration: 2.677171625s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/robots.txt + url: https://example-files.online-convert.com/document/txt/example.txt method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 30 - body: | - User-agent: * - Disallow: /deny + content_length: -1 + uncompressed: true + body: |- + TXT test file + Purpose: Provide example of this file type + Document file type: TXT + Version: 1.0 + Remark: + + Example content: + The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. + + John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. + + Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. + + + + File created by https://www.online-convert.com + More example files: https://www.online-convert.com/file-type + Text of Example content: Wikipedia (https://en.wikipedia.org/wiki/John_Doe) + License: Attribution-ShareAlike 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) + + Feel free to use and share the file according to the license above. headers: Content-Type: - - text/plain + - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 1.51167225s + duration: 211.334459ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31664 + content_length: 36362 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_011NZBWVRQ4Xh8eyVoJ3nkgq\",\"input\":{\"file_path\":\"robots.txt\",\"url\":\"https://httpbin.org/robots.txt\"},\"name\":\"download\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_011NZBWVRQ4Xh8eyVoJ3nkgq\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Successfully downloaded 30 bytes to /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool/robots.txt (Content-Type: text/plain)\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01Pq3udBQnifHqpVC9LQkshK\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool/example.txt\",\"url\":\"https://example-files.online-convert.com/document/txt/example.txt\"},\"name\":\"download\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01Pq3udBQnifHqpVC9LQkshK\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Successfully downloaded 2574 bytes to /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool/example.txt (Content-Type: text/plain; charset=UTF-8)\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -190,29 +261,41 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01QSqoGqpguj55cNYgNJv5yZ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":132,"cache_read_input_tokens":8572,"cache_creation":{"ephemeral_5m_input_tokens":132,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_013boRseAFYLALQKrYvvQyek","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":0,"cache_read_input_tokens":9809,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Downloade"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d successfully to robots.txt"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d example.txt ("} } + + event: ping + data: {"type": "ping"} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"2.5"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" KB"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":")"}} event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":132,"cache_read_input_tokens":8572,"output_tokens":9} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":0,"cache_read_input_tokens":9809,"output_tokens":14} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.052110416s + duration: 3.186378542s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml index 449a9ab534edf7162f11d44e1f2dfc4d7511869f..d6bac16532b6de376ba99496fc5336cfc8c01125 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 800 + content_length: 844 host: "" - body: '{"max_tokens":40,"messages":[{"content":[{"text":"Generate a concise title for the following content:\n\nfetch the content from https://httpbin.org/html and tell me if it contains the word ''Herman''\n \u003cthink\u003e\n\n\u003c/think\u003e","type":"text"}],"role":"user"}],"model":"claude-3-5-haiku-20241022","system":[{"text":"you will generate a short title based on the first message a user begins a conversation with\n\n\u003crules\u003e\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\u003c/rules\u003e\n\n /no_think","type":"text"}],"stream":true}' + body: '{"max_tokens":40,"messages":[{"content":[{"text":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \u003cthink\u003e\n\n\u003c/think\u003e","type":"text"}],"role":"user"}],"model":"claude-3-5-haiku-20241022","system":[{"text":"you will generate a short title based on the first message a user begins a conversation with\n\n\u003crules\u003e\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\u003c/rules\u003e\n\n /no_think","type":"text"}],"stream":true}' headers: Accept: - application/json @@ -25,52 +25,58 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01RUyzrmHuHEw9TvX3rixMe3","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":154,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01PHhkLk3EFtPhGm5L8JcDWA","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":167,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Web"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Web"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Content"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Scraping"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Search"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" an"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" for"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Search"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Herman"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" for"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" John"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Doe"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":154,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":8} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":167,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":13} } event: message_stop - data: {"type":"message_stop"} + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 595.997458ms + duration: 615.9145ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31183 + content_length: 35773 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -87,96 +93,150 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01RmP4xiG55hdipxUhwpavNL","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1723,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1723,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_019wVVescUQgTxEW3qt1GwjD","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":9646,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_019Zy35FKQEvqpif3dU6EsXR","name":"fetch","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01HFh1bn3oTpN7gjezCfH2Kt","name":"fetch","input":{}} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"url\": \"h"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ttps://exa"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mple-fi"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"les.o"}} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nline-"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"convert.com"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"url\": \""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/websit"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"https://ht"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e/html/e"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tpbin.org/ht"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"xample"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ml\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".htm"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"fo"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"l\""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rmat\":"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"form"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \"text\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"at\": "} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"text\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1723,"cache_read_input_tokens":6852,"output_tokens":75} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":9646,"output_tokens":86} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.512604s + duration: 3.952177667s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/html + url: https://example-files.online-convert.com/website/html/example.html method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 3741 + content_length: -1 + uncompressed: true body: |- + - - - -

Herman Melville - Moby-Dick

- -
-

- Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency. -

-
- + + +

HTML test file

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ + headers: Content-Type: - - text/html; charset=utf-8 + - text/html; charset=UTF-8 status: 200 OK code: 200 - duration: 1.437732167s + duration: 74.761125ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 35117 + content_length: 38658 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_019Zy35FKQEvqpif3dU6EsXR\",\"input\":{\"format\":\"text\",\"url\":\"https://httpbin.org/html\"},\"name\":\"fetch\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_019Zy35FKQEvqpif3dU6EsXR\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Herman Melville - Moby-Dick Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency.\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01HFh1bn3oTpN7gjezCfH2Kt\",\"input\":{\"format\":\"text\",\"url\":\"https://example-files.online-convert.com/website/html/example.html\"},\"name\":\"fetch\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01HFh1bn3oTpN7gjezCfH2Kt\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -193,28 +253,28 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01We6KJFYXWFHoBbvS3WUE3a","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":980,"cache_read_input_tokens":8575,"cache_creation":{"ephemeral_5m_input_tokens":980,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_013yfoUMMJPebkePUgXigvEk","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":0,"cache_read_input_tokens":10356,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Yes"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Yes"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":", it contains \"Herman Melville\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":", it contains \"John Doe\" multiple"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" at the beginning."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" times."} } event: ping data: {"type": "ping"} event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: ping data: {"type": "ping"} @@ -223,14 +283,14 @@ interactions: data: {"type": "ping"} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":980,"cache_read_input_tokens":8575,"output_tokens":17} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":0,"cache_read_input_tokens":10356,"output_tokens":15} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.182546s + duration: 2.328589209s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml index 43876dff8610889cb5c7b017e5eb52b598aaf219..393a4da90eb7c7e7703fc8cf264af300127c3e18 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml @@ -25,52 +25,52 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01TRsP6tDfcqt14jh6xiLgC8","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01DAnqMv5qFj8Tc1b53puwVh","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Fin"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Fin"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Go"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Files"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Files"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" with"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Using"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Glob"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Glob"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9}} + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 582.017417ms + duration: 601.492292ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31145 + content_length: 35691 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -87,49 +87,46 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01U6gxGnSnXXqzqQmZ8HBkbr","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1711,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1711,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}}} + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_014xATVMFnNq7yfJSgiNBkpw","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2769,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2769,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01QQQF8nkTSANmvN7T7QcgKy","name":"glob","input":{}} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""}} + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01GRCHWtjjk7nGhVvAmSQyT4","name":"glob","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"pat"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tern\": \""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"patter"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"*.go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n\": \"*.g"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1711,"cache_read_input_tokens":6852,"output_tokens":52} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2769,"cache_read_input_tokens":6852,"output_tokens":52} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.731662667s + duration: 2.959244958s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31515 + content_length: 36061 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01QQQF8nkTSANmvN7T7QcgKy\",\"input\":{\"pattern\":\"*.go\"},\"name\":\"glob\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01QQQF8nkTSANmvN7T7QcgKy\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01GRCHWtjjk7nGhVvAmSQyT4\",\"input\":{\"pattern\":\"*.go\"},\"name\":\"glob\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01GRCHWtjjk7nGhVvAmSQyT4\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -146,38 +143,29 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01ChnVVsE4Gffr3DmzfW151j","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":8563,"cache_creation":{"ephemeral_5m_input_tokens":86,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01QxSXXJqB3otmBRX83NBKBU","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":9621,"cache_creation":{"ephemeral_5m_input_tokens":86,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"main"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".go"} } - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d: main.go"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: ping - data: {"type": "ping"} - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":8563,"output_tokens":6} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":9621,"output_tokens":8} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.063459333s + duration: 2.442994s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml index 55f7854c51df4514fb6ade1798c1599bc72397a8..5527489c3044765e2052c9e5661b788617cf66b8 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml @@ -25,49 +25,52 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01RzWf6ES6f9YqJ9TCwx2PTM","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_013fa6EoYhAdwsz2cYzvHHfi","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Grep"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Search"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Package"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" for "} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Search"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"'package' in Go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" in Go Files"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" files with"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" grep"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":14} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 611.409917ms + duration: 655.533792ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31143 + content_length: 35689 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,58 +87,64 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_015hUDsFsNnCf1wPzRMZQTi6","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1713,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1713,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01PtAR8VWNYDCYT8GR2X3XGS","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2771,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2771,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01DTQVwdtsHh3cMufiwVNKpL","name":"grep","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_019GqQYZ3YauawCgBVD1ZTi8","name":"grep","input":{}}} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"patt"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"patt"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"er"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ern\""}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n\": "} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"packa"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"package\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ge\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"incl"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"i"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ud"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nclude\": \""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"*.go\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"*.go"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1713,"cache_read_input_tokens":6852,"output_tokens":69} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2771,"cache_read_input_tokens":6852,"output_tokens":69} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.153163666s + duration: 3.250877833s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31585 + content_length: 36131 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01DTQVwdtsHh3cMufiwVNKpL\",\"input\":{\"include\":\"*.go\",\"pattern\":\"package\"},\"name\":\"grep\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01DTQVwdtsHh3cMufiwVNKpL\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_019GqQYZ3YauawCgBVD1ZTi8\",\"input\":{\"include\":\"*.go\",\"pattern\":\"package\"},\"name\":\"grep\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_019GqQYZ3YauawCgBVD1ZTi8\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -152,35 +161,44 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01QXcSnyz6VZ9XZ6UW1wrdDd","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":8565,"cache_creation":{"ephemeral_5m_input_tokens":125,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_012gikqLr4sWxogoEUZAuTtm","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":9623,"cache_creation":{"ephemeral_5m_input_tokens":125,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 1 match in"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 1 match in main.go:"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" main.go at line 1"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"1"} } + + event: ping + data: {"type": "ping"} event: content_block_stop data: {"type":"content_block_stop","index":0 } + event: ping + data: {"type": "ping"} + + event: ping + data: {"type": "ping"} + event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":8565,"output_tokens":16} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":9623,"output_tokens":14} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.023175666s + duration: 2.246187958s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml index b649f9114775f7113c4b13870c86b0117021b3fb..e5a0dddb65a9ce8fd923818d6c86b28187f5d0c2 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml @@ -25,28 +25,31 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01EFPwwtF4fGytQfsssivQya","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_018PZbN7ZE2pop3qskRG9ZNq","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"List"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Files"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Files"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" in Current Directory"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" in"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Current Directory"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":8}} + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":8} } event: message_stop data: {"type":"message_stop" } @@ -56,15 +59,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 659.769125ms + duration: 619.398417ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31137 + content_length: 35683 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -81,43 +84,46 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01948YnncZbU74ncr4verTH1","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1709,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1709,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}}} + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Hr8qnJhBFsXnQehgEXndoQ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2767,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2767,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_013oz5axoenTuuisp8vWfEKE","name":"ls","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01Rxb178JjwNDED2g3xyDTUo","name":"ls","input":{}}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"path\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"pat"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \".\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\": \"."} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1709,"cache_read_input_tokens":6852,"output_tokens":50} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2767,"cache_read_input_tokens":6852,"output_tokens":50} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.296407042s + duration: 2.255010125s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31521 + content_length: 36067 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_013oz5axoenTuuisp8vWfEKE\",\"input\":{\"path\":\".\"},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_013oz5axoenTuuisp8vWfEKE\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01Rxb178JjwNDED2g3xyDTUo\",\"input\":{\"path\":\".\"},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01Rxb178JjwNDED2g3xyDTUo\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -134,29 +140,44 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01GwPREZa7mYgLyLKjpg1HqG","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":97,"cache_read_input_tokens":8561,"cache_creation":{"ephemeral_5m_input_tokens":97,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_016HdkWPM3NDJLBszeytxXSS","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":97,"cache_read_input_tokens":9619,"cache_creation":{"ephemeral_5m_input_tokens":97,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"The directory"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" contains:\n- go.mod\n- main"} } + + event: ping + data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".mod, main.go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".go"} } + + event: ping + data: {"type": "ping"} event: content_block_stop data: {"type":"content_block_stop","index":0 } + event: ping + data: {"type": "ping"} + + event: ping + data: {"type": "ping"} + event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":97,"cache_read_input_tokens":8561,"output_tokens":10} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":97,"cache_read_input_tokens":9619,"output_tokens":17} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.462024416s + duration: 2.1375305s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml index ece0e5e26e71bf247490bf2eafdcec15bc0afe71..5d7e77a1999aa14b2d8e27a7650c669035d38851 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_011bN7xZaU6JvDk22sRZcraQ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01GhHFffSWHNR9gqqMuzfeTc","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Modify"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Modify"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Println"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Greeting in"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Line"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" in main.go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Program"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":12} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.071607083s + duration: 1.104169583s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31223 + content_length: 35769 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,67 +84,100 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_016Kg1UfhuFT1TjGbrtqtmaX","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1741,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1741,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01UjkzppnFrTP3tgTQyAzLV9","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2799,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2799,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"I'll rea"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"I'll rea"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d the file first, then make both changes with mult"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d the file first to see its current state."} } event: ping data: {"type": "ping"} - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"iedit."} } - event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } + + event: ping + data: {"type": "ping"} event: content_block_start - data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_01Dc4qPTcJkRkZoHoDVrd2rP","name":"view","input":{}} } + data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_01QhLKMCpx56qb6voe3SwrhM","name":"view","input":{}} } + + event: ping + data: {"type": "ping"} + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"file_path"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"\": \"/tmp/c"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"rush-"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"tes"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"t/Te"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"stCoder"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"Agent/ant"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"hro"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"pic-"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"file_"}} + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"son"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"path\": \"ma"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"net/multi"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"in.go"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"edit"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"_tool/main.g"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"o\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":1 } + data: {"type":"content_block_stop","index":1 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1741,"cache_read_input_tokens":6852,"output_tokens":72} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2799,"cache_read_input_tokens":6852,"output_tokens":92} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.508645583s + duration: 2.063048792s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31795 + content_length: 36390 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first, then make both changes with multiedit.\",\"type\":\"text\"},{\"id\":\"toolu_01Dc4qPTcJkRkZoHoDVrd2rP\",\"input\":{\"file_path\":\"main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01Dc4qPTcJkRkZoHoDVrd2rP\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first to see its current state.\",\"type\":\"text\"},{\"id\":\"toolu_01QhLKMCpx56qb6voe3SwrhM\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01QhLKMCpx56qb6voe3SwrhM\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -161,115 +194,154 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01349fDTHN7s5foGh5WPjjNb","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":136,"cache_read_input_tokens":8593,"cache_creation":{"ephemeral_5m_input_tokens":136,"ephemeral_1h_input_tokens":0},"output_tokens":29,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01UegrYJPUFmsh9JFWxZZ4cQ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":156,"cache_read_input_tokens":9651,"cache_creation":{"ephemeral_5m_input_tokens":156,"ephemeral_1h_input_tokens":0},"output_tokens":25,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_016nP4VtJ5XVN4C14i4RN3Um","name":"multiedit","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01VscpYFqvugRYihLrLFWZB2","name":"multiedit","input":{}} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"f"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ile_path\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"/t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_pat"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mp/crush-t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\": \"main.g"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"est/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"TestCod"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"edi"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"er"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ts\": [{\"old"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Age"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"_str"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nt/an"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ing"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"thropic-son"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\":\"fu"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"net/multiedi"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nc "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t_tool/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"main() {\\n\\t"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"main"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"fmt.Println("} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".g"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\"H"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ello, Wor"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ld!\\\")\",\"ne"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"edits\":"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"w_s"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" [{\"old_st"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tring\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ring\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":":\"func ma"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":":\"fun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in("} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"c m"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":") {\\n\\t//"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ain() {\\"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" G"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n\\t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"reeting\\n\\"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"fmt.Println"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tfmt.Prin"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"(\\"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tln(\\\"Hello"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Hel"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", Crush!\\\")"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"lo, World!\\"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\")\",\"new_st"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"]}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ring\""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":":\"func ma"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in() {"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\n"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\t// Greet"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ing\\n\\tf"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mt.Println"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"(\\\"Hell"}} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o, Crus"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h!\\"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\")\"}]}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":136,"cache_read_input_tokens":8593,"output_tokens":147} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":156,"cache_read_input_tokens":9651,"output_tokens":171} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.43646825s + duration: 2.484004459s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 32364 + content_length: 37022 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first, then make both changes with multiedit.\",\"type\":\"text\"},{\"id\":\"toolu_01Dc4qPTcJkRkZoHoDVrd2rP\",\"input\":{\"file_path\":\"main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01Dc4qPTcJkRkZoHoDVrd2rP\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_016nP4VtJ5XVN4C14i4RN3Um\",\"input\":{\"edits\":[{\"new_string\":\"func main() {\\n\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\",\"old_string\":\"func main() {\\n\\tfmt.Println(\\\"Hello, World!\\\")\"}],\"file_path\":\"main.go\"},\"name\":\"multiedit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_016nP4VtJ5XVN4C14i4RN3Um\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first to see its current state.\",\"type\":\"text\"},{\"id\":\"toolu_01QhLKMCpx56qb6voe3SwrhM\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01QhLKMCpx56qb6voe3SwrhM\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01VscpYFqvugRYihLrLFWZB2\",\"input\":{\"edits\":[{\"new_string\":\"func main() {\\n\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\",\"old_string\":\"func main() {\\n\\tfmt.Println(\\\"Hello, World!\\\")\"}],\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"multiedit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01VscpYFqvugRYihLrLFWZB2\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -286,19 +358,19 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_018BziK5si5QR6kdh7aajjXM","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":192,"cache_read_input_tokens":8729,"cache_creation":{"ephemeral_5m_input_tokens":192,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01D6sZEHCLmU4wLV5Lecgcn8","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":216,"cache_read_input_tokens":9807,"cache_creation":{"ephemeral_5m_input_tokens":216,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":192,"cache_read_input_tokens":8729,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":216,"cache_read_input_tokens":9807,"output_tokens":4} } event: message_stop data: {"type":"message_stop" } @@ -308,4 +380,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.259016875s + duration: 2.670162917s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml index 0bae375681dd1e5d00b809e44e1e7190bff7fbbf..740ebc058ec9fc8eb353cb85aec4a639d77740f6 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml @@ -25,52 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_017eiqBiGHLGyQu82xGfSB8X","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01J57AeroUedodirLhogwFwv","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Parallel"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Parallel"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go File"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go File"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Search"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Search and Directory"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" and Directory"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Listing"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Listing"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":12} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":12} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 756.29075ms + duration: 652.221167ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31234 + content_length: 35780 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -87,61 +84,64 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01E5WTyY6paaSBLH5CCLpWmL","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1730,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1730,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01GoxtXttAF7ZU7r34uQL7NY","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2788,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2788,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_012q67vksWc4BpunyFosfU6P","name":"glob","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01YLo7Yudm5u5sdL3osV9MSM","name":"glob","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"pattern\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"patt"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"**/*.g"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ern\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"**/*.go\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: content_block_start - data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_013WXRBgESthmyknEGQGdX2v","name":"ls","input":{}} } + data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_01QsQhWp6dWHupyXLQhwWuin","name":"ls","input":{}} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\""} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"path\": \"."} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"path\": \""} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":".\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":1 } + data: {"type":"content_block_stop","index":1 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1730,"cache_read_input_tokens":6852,"output_tokens":86} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2788,"cache_read_input_tokens":6852,"output_tokens":86} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.8894285s + duration: 2.361447792s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31915 + content_length: 36461 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_012q67vksWc4BpunyFosfU6P\",\"input\":{\"pattern\":\"**/*.go\"},\"name\":\"glob\",\"type\":\"tool_use\"},{\"id\":\"toolu_013WXRBgESthmyknEGQGdX2v\",\"input\":{\"path\":\".\"},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_012q67vksWc4BpunyFosfU6P\",\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"},{\"tool_use_id\":\"toolu_013WXRBgESthmyknEGQGdX2v\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01YLo7Yudm5u5sdL3osV9MSM\",\"input\":{\"pattern\":\"**/*.go\"},\"name\":\"glob\",\"type\":\"tool_use\"},{\"id\":\"toolu_01QsQhWp6dWHupyXLQhwWuin\",\"input\":{\"path\":\".\"},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01YLo7Yudm5u5sdL3osV9MSM\",\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"},{\"tool_use_id\":\"toolu_01QsQhWp6dWHupyXLQhwWuin\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -158,35 +158,38 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_015pSPzxf44b5dNKqog1dGK3","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":8582,"cache_creation":{"ephemeral_5m_input_tokens":207,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_016UApwNxLuA1NaU9fjdRCK1","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":9640,"cache_creation":{"ephemeral_5m_input_tokens":207,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 1 Go file: `main.go`"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d one Go file: main.go"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"\n\nDirectory contains: `go.mod`, `main.go`"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"\n\nCurrent directory contains:\n- go"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".mod\n- main.go"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":8582,"output_tokens":29} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":9640,"output_tokens":26} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.458768125s + duration: 3.906442917s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml index 4290f03170f3cfe5efa6a6e755cbe0297a136d96..3b76746e2374cb2248cf8d2bab6c1827a21b908e 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_0126vEnUQ7o7aRzupozLAUnp","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_015KMXKt4guxgnkBtM4iMMUA","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Review"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Rea"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Go"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Module"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Mo"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Dependencies"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d File"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":8} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 600.96675ms + duration: 553.304875ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31107 + content_length: 35653 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,49 +84,64 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01CD6STj9jSvU2NiHtRTjqPh","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1705,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1705,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01MW2XvGNt4MKUuhHfe8ZkuN","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2763,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2763,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}}} event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01UXMHkffqyrw6nGSyUp36Ap","name":"view","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01APRar24ZbyGgyF5V37ca54","name":"view","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"_path\": \"go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"_path\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".mod"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"/tmp/crus"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h-test/Test"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"CoderAgen"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/anthropic"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"-sonnet/"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"read_a_fil"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e/go.mod\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1705,"cache_read_input_tokens":6852,"output_tokens":55} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2763,"cache_read_input_tokens":6852,"output_tokens":79} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.50069s + duration: 2.222963834s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31517 + content_length: 36123 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01UXMHkffqyrw6nGSyUp36Ap\",\"input\":{\"file_path\":\"go.mod\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01UXMHkffqyrw6nGSyUp36Ap\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01APRar24ZbyGgyF5V37ca54\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file/go.mod\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01APRar24ZbyGgyF5V37ca54\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -143,28 +158,28 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01JvxrCQL1MKHWHg1ouZ6tQF","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":96,"cache_read_input_tokens":8557,"cache_creation":{"ephemeral_5m_input_tokens":96,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_013zoUpx2nFdjzgCA5Xwqnb7","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":9615,"cache_creation":{"ephemeral_5m_input_tokens":120,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Module"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" 1.23, module example.com/testproject, no"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" is `example.com/testproject` with"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" dependencies."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go 1.23."} } event: ping data: {"type": "ping"} event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: ping data: {"type": "ping"} @@ -173,14 +188,14 @@ interactions: data: {"type": "ping"} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":96,"cache_read_input_tokens":8557,"output_tokens":20} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":9615,"output_tokens":20} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.386795834s + duration: 2.377204042s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml index ce60e160180e92fd2158cb5cd12f95cdd0c0eeb4..6e47c604d1f4b54be1b06eb2e50c9f81ba06dc26 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml @@ -25,46 +25,55 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_014kwk8LeCrDLVUHwtvdWe5y","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_018RMdoapMV6AWAHnha4Wdqe","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Quick"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Greeting"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Chat"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Initiate"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Start"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d"}} + + event: ping + data: {"type": "ping"} event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } + + event: ping + data: {"type": "ping"} + + event: ping + data: {"type": "ping"} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 748.485709ms + duration: 1.080700459s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31097 + content_length: 35643 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Hello\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Hello\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -81,29 +90,29 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01FyJYBee7XM5UZMHDRiVpz7","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":8552,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":8552,"ephemeral_1h_input_tokens":0},"output_tokens":5,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_017zCYJUUsZV4SRt3WZmcqPS","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2758,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2758,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello! I'm ready"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello! How"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" to help. What would you like to do?"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" can I help you today?"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":8552,"cache_read_input_tokens":0,"output_tokens":18} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2758,"cache_read_input_tokens":6852,"output_tokens":12} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.3804415s + duration: 2.818675875s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml index ac6cfacad0112a9a77420a617153ab95cb3fca4c..1ecf371329cb494c5456885fd2802198dea85340 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml @@ -25,52 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_013YipYtB4pPD2dsY23bK1nj","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_018Qh9AMUggmbex2YefzC6Q1","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Searching "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Searching Go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"'func main' in"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Repos"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go repos"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" with"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" for Main"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Sourcegraph"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Function"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":18} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":11} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 954.205583ms + duration: 738.233833ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31157 + content_length: 35703 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -87,53 +84,50 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01NoLeZ1AJ2R7Fnk4fMtY9A6","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1716,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1716,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01A8pokXrftshJS2Vr3eSFaD","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2774,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2774,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01WxTwSoBycRW1bxYFLJUCnA","name":"sourcegraph","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01DNMpiNjd8wvSnwAaLY82tD","name":"sourcegraph","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"quer"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"query\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"y\": \"lan"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"g:go fun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"lang:go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"c ma"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" func ma"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"cou"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"count\":"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nt\":"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" 20}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" 20}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1716,"cache_read_input_tokens":6852,"output_tokens":74} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2774,"cache_read_input_tokens":6852,"output_tokens":74} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.412315s + duration: 2.213287709s - id: 2 request: proto: HTTP/1.1 @@ -161,15 +155,15 @@ interactions: - application/json status: 200 OK code: 200 - duration: 1.459370042s + duration: 1.407771333s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 39032 + content_length: 43578 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01WxTwSoBycRW1bxYFLJUCnA\",\"input\":{\"count\":20,\"query\":\"lang:go func main\"},\"name\":\"sourcegraph\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01WxTwSoBycRW1bxYFLJUCnA\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n```\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| \\tFuncB()\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n```\\n\\n```\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tfmt.Println(\\\"FuncA\\\")\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n```\\n\\n```\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| func FuncF() {\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n```\\n\\n```\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| \\tfmt.Println(\\\"FuncF\\\")\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n```\\n\\n```\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tFuncE()\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n```\\n\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01DNMpiNjd8wvSnwAaLY82tD\",\"input\":{\"count\":20,\"query\":\"lang:go func main\"},\"name\":\"sourcegraph\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01DNMpiNjd8wvSnwAaLY82tD\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n```\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| \\tFuncB()\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n```\\n\\n```\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tfmt.Println(\\\"FuncA\\\")\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n```\\n\\n```\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| func FuncF() {\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n```\\n\\n```\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| \\tfmt.Println(\\\"FuncF\\\")\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n```\\n\\n```\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tFuncE()\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n```\\n\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -186,50 +180,59 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Eoh2qucbrabMAdn8updnvB","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":8568,"cache_creation":{"ephemeral_5m_input_tokens":3890,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01CpMz1Fofv4ZCFFnGyBkBeT","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":9626,"cache_creation":{"ephemeral_5m_input_tokens":3890,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 30 matches across public Go repositories. All results"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 30 matches for "} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" are from `github.com/jcalab"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"'func main' in Go repositories. The"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" search hit the result limit - most matches"}} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" are from github.com/jcalabro"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"/uscope/assets/gobacktrace/main.go showing"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"ro/uscope/assets/"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" various main function implementations that call"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"gobacktrace/main.go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" helper functions (FuncA through FuncF)."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"` showing a `func main()` that"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Use a more specific query (e.g., ad"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" calls multiple functions (FuncA through"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d repo filter or additional keywords) to narrow"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" FuncF)."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" results."} } event: content_block_stop data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":8568,"output_tokens":63} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":9626,"output_tokens":92} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.518737541s + duration: 2.639515583s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml index 323cc6d9a336fcc4ac911e5ec9f83366f3ea53e0..917da2559657b98ea00e5b70e5c80cc8059be13a 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml @@ -25,46 +25,46 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01V2gbirhEyjs4DiYnh93EC9","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01CxUo5Lns3Y5QFcq5sNF8Hj","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Update"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Update"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" main.go hello"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" main.go Hello"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" print"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Message"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 700.907542ms + duration: 788.82125ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31163 + content_length: 35709 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -81,49 +81,94 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01BGZLUc1twLVbQk15aHwo1v","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1716,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1716,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01UmMJs2XPkLzXApVpWRweuf","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2774,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2774,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}}} event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_011XTovZHHrqbeMteDcXFDxD","name":"view","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"I'll rea"}} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d the file first, then update it."} } + + event: ping + data: {"type": "ping"} + + event: content_block_stop + data: {"type":"content_block_stop","index":0 } + + event: ping + data: {"type": "ping"} + + event: content_block_start + data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_017LDz1Tov99rrvVpTvXeArr","name":"view","input":{}} } + + event: ping + data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_pat"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"file"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\": "} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"_path\": \"/t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"main.go"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"mp/crush-t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"}"}} + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"est/Tes"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"tCoderAgen"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"t/anthropic-"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"sonnet/u"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"pdat"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"e_a"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"_f"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"ile"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"/main.go\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":1 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1716,"cache_read_input_tokens":6852,"output_tokens":55} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2774,"cache_read_input_tokens":6852,"output_tokens":91} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.543036458s + duration: 2.223364666s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31645 + content_length: 36320 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_011XTovZHHrqbeMteDcXFDxD\",\"input\":{\"file_path\":\"main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_011XTovZHHrqbeMteDcXFDxD\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first, then update it.\",\"type\":\"text\"},{\"id\":\"toolu_017LDz1Tov99rrvVpTvXeArr\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_017LDz1Tov99rrvVpTvXeArr\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -140,115 +185,118 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01SxNBCVbJi3vF81CoCZVean","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":8568,"cache_creation":{"ephemeral_5m_input_tokens":120,"ephemeral_1h_input_tokens":0},"output_tokens":33,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_017FJ3aridqbds3azs5yiEoj","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":155,"cache_read_input_tokens":9626,"cache_creation":{"ephemeral_5m_input_tokens":155,"ephemeral_1h_input_tokens":0},"output_tokens":25,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_017DGAG8X47hb2gawfBGnBz1","name":"edit","input":{}}} + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_017zx3JLgd5A2pNbUGMx7Gdf","name":"edit","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_path\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"m"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"/tm"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"p/crush-tes"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ain"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/Tes"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".go\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tCoderA"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"ol"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"gent"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"d_st"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/anth"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ring\": \"func"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ropic-s"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" main()"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"onne"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" {\\n\\tfmt"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/update_"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".P"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"a_file/main."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ri"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"go\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ntln(\\\"Hell"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"old_stri"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o, Worl"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ng\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"d!"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"\\tfmt."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\")\\n}\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Println"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"new_str"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"(\\\"H"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ing\": \"f"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ello, World"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"unc main()"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"!\\\")\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" {\\n\\tf"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"new_s"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mt."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tr"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Println"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ing\": \"\\tfm"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"(\\\"hel"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t.Println(\\\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"lo f"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"hello from"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rom crush"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" c"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\")\\n"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rus"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"}\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\\\")\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":8568,"output_tokens":123} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":155,"cache_read_input_tokens":9626,"output_tokens":135} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.447528917s + duration: 2.286473375s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 32191 + content_length: 36892 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_011XTovZHHrqbeMteDcXFDxD\",\"input\":{\"file_path\":\"main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_011XTovZHHrqbeMteDcXFDxD\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_017DGAG8X47hb2gawfBGnBz1\",\"input\":{\"file_path\":\"main.go\",\"new_string\":\"func main() {\\n\\tfmt.Println(\\\"hello from crush\\\")\\n}\",\"old_string\":\"func main() {\\n\\tfmt.Println(\\\"Hello, World!\\\")\\n}\"},\"name\":\"edit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_017DGAG8X47hb2gawfBGnBz1\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first, then update it.\",\"type\":\"text\"},{\"id\":\"toolu_017LDz1Tov99rrvVpTvXeArr\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_017LDz1Tov99rrvVpTvXeArr\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_017zx3JLgd5A2pNbUGMx7Gdf\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\",\"new_string\":\"\\tfmt.Println(\\\"hello from crush\\\")\",\"old_string\":\"\\tfmt.Println(\\\"Hello, World!\\\")\"},\"name\":\"edit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_017zx3JLgd5A2pNbUGMx7Gdf\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -265,26 +313,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_0156vJYCmnoDHddugupfiaQP","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":175,"cache_read_input_tokens":8688,"cache_creation":{"ephemeral_5m_input_tokens":175,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01UZYxRXrZr73ZgpH9CVpHDD","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":187,"cache_read_input_tokens":9781,"cache_creation":{"ephemeral_5m_input_tokens":187,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":175,"cache_read_input_tokens":8688,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":187,"cache_read_input_tokens":9781,"output_tokens":4} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.651659958s + duration: 2.631110042s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml index d483fe592e03cb00b28b04e16088e328b8b8b13f..b0e561aef297bd8dd731992543c9b466c5941d69 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml @@ -25,52 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01Vo9QhQKAZCU1jVuEKC4btz","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_0135cYAEgyr7BqB2Wths5y1Q","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Create"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Create"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" config"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Config"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".json with"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" JSON"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" initial"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" settings"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" File"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 631.479458ms + duration: 641.8005ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31200 + content_length: 35746 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -87,73 +84,100 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01XtasmW2DxtD4cnkmhd1C33","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":1730,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":1730,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01K9un1gWc6cDrEECt2n6yuX","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":2788,"cache_read_input_tokens":6852,"cache_creation":{"ephemeral_5m_input_tokens":2788,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_0111efm6idsGJJAJHVk5PN6N","name":"write","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01Enp2B1tSyhBS41aWBt4kmk","name":"write","input":{}} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_pat"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\":"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \"/tmp/cr"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ush-test/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_path"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"TestCoderAg"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \"config"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ent/anth"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".json\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ro"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"content\""}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"pic-s"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"{\\"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"onnet/writ"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"name"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e_tool/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\":"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"config.js"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \\\"test\\\","} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"on\""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \\\"version\\"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"cont"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": "}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"en"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\"1"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t\": \"{\\\"name"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".0.0\\\"}\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\": \\\"test\\\""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \\\"ve"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rsio"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n\\"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \\\""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"1.0.0\\\"}\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":1730,"cache_read_input_tokens":6852,"output_tokens":87} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":2788,"cache_read_input_tokens":6852,"output_tokens":109} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.252533792s + duration: 2.215506125s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31710 + content_length: 36315 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_0111efm6idsGJJAJHVk5PN6N\",\"input\":{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"config.json\"},\"name\":\"write\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_0111efm6idsGJJAJHVk5PN6N\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nFile successfully written: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool/config.json\\n\\u003c/result\\u003e\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\u003c/communication_style\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01Enp2B1tSyhBS41aWBt4kmk\",\"input\":{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool/config.json\"},\"name\":\"write\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01Enp2B1tSyhBS41aWBt4kmk\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nFile successfully written: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool/config.json\\n\\u003c/result\\u003e\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\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\\u003c/best_practices\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\u003c/operation\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\u003c/warnings\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\u003c/best_practices\\u003e\\n\\n\\u003cnew_file_creation\\u003e\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\u003c/new_file_creation\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -170,26 +194,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Vh3sXDUeWbkvbyKPgMqnL5","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":133,"cache_read_input_tokens":8582,"cache_creation":{"ephemeral_5m_input_tokens":133,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_015W6mU65R71q9sj76Ri91ZD","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":155,"cache_read_input_tokens":9640,"cache_creation":{"ephemeral_5m_input_tokens":155,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":133,"cache_read_input_tokens":8582,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":155,"cache_read_input_tokens":9640,"output_tokens":4}} event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.434365708s + duration: 2.637920958s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml index b503905f2eae4c3ced94f56e30ed3ee7946d83b6..d752f7877b823a341d7e4cc1882d68992ff37675 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml @@ -24,23 +24,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5WTtJ1eUbukmUe"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"i4I8kypUOjGh2F"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Create"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"AcHAYVWbkS"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Create"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Uu2PMXqQ5D"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" a"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"aOZz7fwokXQlkz"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" test"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QbbZrKZWFOR"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"SkN5keGHx06"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":".txt"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MHS3nwcRPHu3"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"PCTyR9QwLQU"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"aqaVs4Hvyni"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Bash"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"igMrV8UPPfL"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZOTpTEhoEoEI3X"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Command"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"6zycsBVC"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Fbk3BOcKpVE"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"3b8Ax2Ojnq"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" bash"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZrlUqDhkIs0"} - data: {"id":"chatcmpl-CToETSSbaB9YSlMZKEcIMOx60Csyx","object":"chat.completion.chunk","created":1761220641,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":139,"completion_tokens":6,"total_tokens":145,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"ilSb8f05W03KWu"} + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"s30OeHvrIugeu5S"} + + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" using"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"aPewwF6F6U"} + + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Bash"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"gDn4WG7W0SF"} + + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"r6kHmIcLG6"} + + data: {"id":"chatcmpl-CTtUFcbirl3Cg6GH59fLIhj5HZC95","object":"chat.completion.chunk","created":1761240839,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":139,"completion_tokens":10,"total_tokens":149,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"MhCifXPdkTjBG"} data: [DONE] @@ -49,15 +57,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 921.929791ms + duration: 987.647333ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29876 + content_length: 34332 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -73,111 +81,111 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null},"finish_reason":null}],"obfuscation":"nWqzf1s"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_TsAyPP3x2qHNPBUxBHiPFrg1","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"h7YLm0PDjFke"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_zxRiwoXvL3JbHjuK2wfHPuFs","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null}],"obfuscation":"utjX0A3kS6HFFaS"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"u5HYr7A3Dnxdoa5"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"pa"}}]},"finish_reason":null}],"obfuscation":"VHuowH8TNjWM9"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d8ztoCjiL2f"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"th\": "}}]},"finish_reason":null}],"obfuscation":"Nt4LlxGt0mFq"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"8apmty3kAvnKT"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/tmp/"}}]},"finish_reason":null}],"obfuscation":"fl5Tpt60fZ4"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"printf"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zkFdPeUihYKr"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"crus"}}]},"finish_reason":null}],"obfuscation":"79ErhgoObYAzxw"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" '"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"h-tes"}}]},"finish_reason":null}],"obfuscation":"TJLpGAbMyYlCj"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ShjHpW7S9le8z"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"t/Test"}}]},"finish_reason":null}],"obfuscation":"osNuMBXcNfVK"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wWeWod0e9SPQi"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Code"}}]},"finish_reason":null}],"obfuscation":"EXk5Rn2DafIU97"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"'"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"rAgen"}}]},"finish_reason":null}],"obfuscation":"3P41kXZ6rNpL0"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" >"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"t/open"}}]},"finish_reason":null}],"obfuscation":"4oCL8CAsxuix"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai-g"}}]},"finish_reason":null}],"obfuscation":"3QERq3nbt6AKDg"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lcKPdLuHedU2YGH"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt-5/"}}]},"finish_reason":null}],"obfuscation":"cwka1DGiMbaPN"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gjzQWl0TjUPKyHk"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"bash_t"}}]},"finish_reason":null}],"obfuscation":"SEC0Q66JbKqt"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dPjvdLwlL91kUMk"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ool\""}}]},"finish_reason":null}],"obfuscation":"Dc8VnnSN2PSfU"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JYVlVXFMCC0JU"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":", \"de"}}]},"finish_reason":null}],"obfuscation":"NjKkSvYPVLBv"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1xE8H9bt6s8TS"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pth\": "}}]},"finish_reason":null}],"obfuscation":"nqyvpeQPFm2"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ufJr0bhY0FSsq"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"1}"}}]},"finish_reason":null}],"obfuscation":""} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wqD3oDnSGzPJg"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_aKrRv7qkfWJU7W8RpfGscsLN","type":"function","function":{"name":"bash","arguments":""}}]},"finish_reason":null}],"obfuscation":"spbOL8uhgpgsF"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"boT1BjBzwHIzk"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{\"co"}}]},"finish_reason":null}],"obfuscation":"l1TaqVAaLhbJQ"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"mmand"}}]},"finish_reason":null}],"obfuscation":"twm5gJTdVf2vy"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"\": \"pr"}}]},"finish_reason":null}],"obfuscation":"ISs6EQkAPK"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"intf"}}]},"finish_reason":null}],"obfuscation":"GQczPsRKFaliXl"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":" 'hel"}}]},"finish_reason":null}],"obfuscation":"n6vz7X5YWr7tR"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"lo bas"}}]},"finish_reason":null}],"obfuscation":"nPUTxAj3rtCV"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Abu51z83rQx7u"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"h' >"}}]},"finish_reason":null}],"obfuscation":"q5MfofSUYksG0q"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wFul28mOxV3T6"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":" /tmp"}}]},"finish_reason":null}],"obfuscation":"wKffSWOhi4U1l"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RPAlnPThUVDOt"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"/crush"}}]},"finish_reason":null}],"obfuscation":"hnWVxw2UITyu"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Gqoi387OGjxdQI"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"-tes"}}]},"finish_reason":null}],"obfuscation":"yNIRDWmnBj1YMP"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"dpT0bc71KeE6Z"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"t/Tes"}}]},"finish_reason":null}],"obfuscation":"UyySVnBHPx8uK"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QgwCJQP"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"tCoder"}}]},"finish_reason":null}],"obfuscation":"dfH5PBYpACte"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"NqyTafExQs6io"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"Agen"}}]},"finish_reason":null}],"obfuscation":"FlfTC0IjDo7wpx"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Create"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RTNWctp8OIeK"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"t/ope"}}]},"finish_reason":null}],"obfuscation":"yleGcKRQfBkYk"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4mM1IKtEAsjap"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"nai-gp"}}]},"finish_reason":null}],"obfuscation":"DJfenvE3lAfI"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y1sJjcC4qXTo6b"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"t-5/"}}]},"finish_reason":null}],"obfuscation":"cu6JqV2pFk1ssl"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" with"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2KhI7gKjfttej"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"bash_"}}]},"finish_reason":null}],"obfuscation":"kT72KQJuVjqJa"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" exact"}}]},"finish_reason":null}],"usage":null,"obfuscation":"46NoES4LYeap"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"tool/t"}}]},"finish_reason":null}],"obfuscation":"m92wDNjF9oVM"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xChtZUlkUM"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"est."}}]},"finish_reason":null}],"obfuscation":"MEagnhj45EjvGH"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" '"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"txt\","}}]},"finish_reason":null}],"obfuscation":"FRknPoqNFSps"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"90Mw9sDFO0gz8"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":" \"desc"}}]},"finish_reason":null}],"obfuscation":"xySSJRkCxjS"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h9rTZyrGfT8wR"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ript"}}]},"finish_reason":null}],"obfuscation":"beWVOpPPh4Jgxp"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"'"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ion\":"}}]},"finish_reason":null}],"obfuscation":"a2ScZYCqu4WT"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" ("}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":" \"Crea"}}]},"finish_reason":null}],"obfuscation":"YLNb1rJFheK"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"no"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"te t"}}]},"finish_reason":null}],"obfuscation":"3y0NLCKk7pEaN3"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" trailing"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BLXQUMh9Z"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"est.t"}}]},"finish_reason":null}],"obfuscation":"HJbSSO2viwvUu"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" newline"}}]},"finish_reason":null}],"usage":null,"obfuscation":"egBacKXlCE"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"xt wit"}}]},"finish_reason":null}],"obfuscation":"NQEtsFqR9IBv"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"D"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"h sp"}}]},"finish_reason":null}],"obfuscation":"jabrUA2rzh7BjC"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" in"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yseNkWQhG3A0DUS"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ecifi"}}]},"finish_reason":null}],"obfuscation":"mTiFqWOpmiEAw"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" current"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oqCapz098X"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"c cont"}}]},"finish_reason":null}],"obfuscation":"z2ZYFYi1piK4"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" directory"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TLVv3ThY"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ent\""}}]},"finish_reason":null}],"obfuscation":"k1C36kkqB7dgf"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"nFnmrIfbIZw91lC"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"}"}}]},"finish_reason":null}],"obfuscation":"9"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToETyeL4kJlMQdIe02g2dqGjJL0K","object":"chat.completion.chunk","created":1761220641,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6476,"completion_tokens":680,"total_tokens":7156,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":576,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"cjcP"} + data: {"id":"chatcmpl-CTtUFLknXm0SiwZRdwH8h6mQd61yc","object":"chat.completion.chunk","created":1761240839,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7409,"completion_tokens":772,"total_tokens":8181,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":704,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"b"} data: [DONE] @@ -186,98 +194,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 19.289595708s + duration: 13.909972666s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30614 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_zxRiwoXvL3JbHjuK2wfHPuFs\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\\", \\\"depth\\\": 1}\",\"name\":\"ls\"},\"type\":\"function\"},{\"id\":\"call_aKrRv7qkfWJU7W8RpfGscsLN\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"printf 'hello bash' > /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool/test.txt\\\", \\\"description\\\": \\\"Create test.txt with specific content\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool/\\n - go.mod\\n - main.go\\n - test.txt\\n\",\"tool_call_id\":\"call_zxRiwoXvL3JbHjuK2wfHPuFs\",\"role\":\"tool\"},{\"content\":\"no output\",\"tool_call_id\":\"call_aKrRv7qkfWJU7W8RpfGscsLN\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.openai.com/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_hjkxRnPUeSqUDP1EdGWNeByg","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"5gOobPr2axxp"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"yg4BpxCv7qNVdip"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KGKpH0XBoRHUtm"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OatPDZoPPy9uw"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dMDN3Kn97lCRUOZ"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6zgThxW7RKw4kjw"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Dd0bHn3VGo5Fatc"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N2BEN7rtkzvjKiQ"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LvHXjwW7IROk5iL"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ybNMH63HMHb0b"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4SFAkQfj9bSa0"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qkLsZWvXZn0XV"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NitbZj885D35L"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PnirFD29ot5Kt"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"q"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gWcZK8V9NxE4P"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TyB6lEslSe7Kw"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AkF7o6evBzeh5"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"09EvVghHMQG61d"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VWu4rxVZ9QV3YYP"} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CToEncom0cCfTCzbZlfGASg971EAS","object":"chat.completion.chunk","created":1761220661,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6629,"completion_tokens":360,"total_tokens":6989,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":320,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"b"} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 7.354608667s -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 30943 + content_length: 34766 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_zxRiwoXvL3JbHjuK2wfHPuFs\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\\", \\\"depth\\\": 1}\",\"name\":\"ls\"},\"type\":\"function\"},{\"id\":\"call_aKrRv7qkfWJU7W8RpfGscsLN\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"printf 'hello bash' > /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool/test.txt\\\", \\\"description\\\": \\\"Create test.txt with specific content\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool/\\n - go.mod\\n - main.go\\n - test.txt\\n\",\"tool_call_id\":\"call_zxRiwoXvL3JbHjuK2wfHPuFs\",\"role\":\"tool\"},{\"content\":\"no output\",\"tool_call_id\":\"call_aKrRv7qkfWJU7W8RpfGscsLN\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_hjkxRnPUeSqUDP1EdGWNeByg\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool/test.txt\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|hello bash\\n\\n\",\"tool_call_id\":\"call_hjkxRnPUeSqUDP1EdGWNeByg\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_TsAyPP3x2qHNPBUxBHiPFrg1\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"printf 'hello bash' > /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool/test.txt\\\",\\\"description\\\":\\\"Create test.txt with exact content 'hello bash' (no trailing newline) in current directory.\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_TsAyPP3x2qHNPBUxBHiPFrg1\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -293,13 +218,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CToEuzmiPKNzYVAFsdTxnyOYEWF9J","object":"chat.completion.chunk","created":1761220668,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"Sn6qz0bMkH"} + data: {"id":"chatcmpl-CTtUTJPHC4vFfeTeRsl5tQWpj8aDx","object":"chat.completion.chunk","created":1761240853,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"eAcF7k7QIq"} - data: {"id":"chatcmpl-CToEuzmiPKNzYVAFsdTxnyOYEWF9J","object":"chat.completion.chunk","created":1761220668,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"Bk5IMYBx"} + data: {"id":"chatcmpl-CTtUTJPHC4vFfeTeRsl5tQWpj8aDx","object":"chat.completion.chunk","created":1761240853,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"eKGgAFZA"} - data: {"id":"chatcmpl-CToEuzmiPKNzYVAFsdTxnyOYEWF9J","object":"chat.completion.chunk","created":1761220668,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"8xqXr9"} + data: {"id":"chatcmpl-CTtUTJPHC4vFfeTeRsl5tQWpj8aDx","object":"chat.completion.chunk","created":1761240853,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"ZBW2sm"} - data: {"id":"chatcmpl-CToEuzmiPKNzYVAFsdTxnyOYEWF9J","object":"chat.completion.chunk","created":1761220668,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6686,"completion_tokens":4,"total_tokens":6690,"prompt_tokens_details":{"cached_tokens":6528,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"wAiiq"} + data: {"id":"chatcmpl-CTtUTJPHC4vFfeTeRsl5tQWpj8aDx","object":"chat.completion.chunk","created":1761240853,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7483,"completion_tokens":4,"total_tokens":7487,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"V9xzL"} data: [DONE] @@ -308,4 +233,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.450261s + duration: 2.158241417s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml index a5687f75260083959296935e6d74982f5aea988b..bb0b99983fcf960bdf67c3c9a9da360df29a851b 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 737 + content_length: 773 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://httpbin.org/robots.txt and save it as robots.txt\n \n\n","role":"user"}],"model":"gpt-4o","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\n \n\n","role":"user"}],"model":"gpt-4o","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' headers: Accept: - application/json @@ -24,25 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"aOf6Uq2gmjjEnk"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Dpi7AskhYMHjgK"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Downloading"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"cl9o1"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{"content":"Download"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"hIgpKI7g"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9nBRuhOZhwMk"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"2VHAkxN8jBQF"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Saving"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"0BdLlaA3m"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{"content":" Save"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"2jqYujaAAOp"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" a"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"P50lp0jeWmmryd"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{"content":" Example"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OagbKrXz"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"V8U0cjetBS7"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{"content":" Text"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"71G6Jzy0G3Z"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" from"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ChRD5xbbKK3"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"p32RvNeZDMD"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" URL"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"t8jg2RdgsEsM"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"zYNTfInk3g"} - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"Tqupyqu7xS"} - - data: {"id":"chatcmpl-CTntkZ4Vn1brlEnRZA94CCWZ3DLtp","object":"chat.completion.chunk","created":1761219356,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":143,"completion_tokens":7,"total_tokens":150,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"gyWGJIgsdlA1ge"} + data: {"id":"chatcmpl-CTtDS3FvZqNQVfvDmAntCCBgJGQU4","object":"chat.completion.chunk","created":1761239798,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_f64f290af2","choices":[],"usage":{"prompt_tokens":148,"completion_tokens":6,"total_tokens":154,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Dwqa38Xh4OJYKL"} data: [DONE] @@ -51,15 +49,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.728080375s + duration: 1.479031417s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29893 + content_length: 34385 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -75,55 +73,97 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_DrHW4u4iTI0tW9Yd0T9Y3zfb","type":"function","function":{"name":"download","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"1CckjDsR"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_vdFm0lObjnIFZhcKuIVkaK3y","type":"function","function":{"name":"download","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"WOjLXt3z"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RBUeO3mQi54uJ2K"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1J0701tYOQq3m1"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r4ViWrMzAnPig"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KSUr6P0bDcKYDar"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o6CHnI9qQx11dT4"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RmEMA9WAi7tGgsu"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"E6QkKt2iePOvbmt"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VhpAzSv8UB8vcB4"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"W7G73vX2Pk7oc"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nsBYOPBo89E3E"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"stpMsKmr5bnpX"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EAMFoPhZVzcQO"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rPn4MsfvEBiOE"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"zSWlXPvy488pkgv"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"url"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CTCI5cnzJBdkJlL"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"K2EA6iyXpIw6E"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"https"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1bi8sgqTlaUjP"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"://"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lNisILsX5pd47du"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/download"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tAIcvV4pv"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"http"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7HYJuiNYj8sO2Q"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o4GKxqORS4wAm"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"bin"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HfVkM35kmNLwVu2"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oAlSEJ38qc"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".org"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sz3kT9TFTkIFXV"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gCNzlIo0RNnYyS"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"si8NZ8uaAHbxi"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"robots"}}]},"finish_reason":null}],"usage":null,"obfuscation":"D4MJ9bwJL4O0"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"url"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BMQD3yRIqnLNn2j"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0XXrGfWRb4zX76"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"N75zhZUqEabg8"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"qOjgoYIkEqyoP"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"https"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UWKiPRTLU74gx"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wookodCliEVO4i"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"://"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7NgPAXwl2XaLHSo"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BQIOAxONiYbcj"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6euVNXn4s7O"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Sc4p9oDi9IQPj"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-files"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dfcmtcKOyfGT"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"robots"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dbPeDeVa5ruP"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".online"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xbID8Z3EIeK"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KxStUP8JCHae3T"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-con"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IePoJYSLAIQ6vw"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"UXiiKEEOqxR2x"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"vert"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hP2Xn7o9bn7VjG"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1dYuTr09ENC"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".com"}}]},"finish_reason":null}],"usage":null,"obfuscation":"siXeiix22gZw9T"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dX23x9icExMPVE2"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/document"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JgzO2KCUN"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"60"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/t"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"xt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"znM1IG2Pjh"} - data: {"id":"chatcmpl-CTntleHvADCmRxvdNQTUUIQZLzppr","object":"chat.completion.chunk","created":1761219357,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6479,"completion_tokens":615,"total_tokens":7094,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":576,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"eXpL"} + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y4ugakhkF5PQ71"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"awmeUkhvDcGkt"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c9v6ORQrQRK"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9EPrTzq1mghI1D6"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"120"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7fO1uWpBPyj4U40"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7"} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtDSgfLyehUDT9okcSGEBGz1W3E5","object":"chat.completion.chunk","created":1761239798,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7417,"completion_tokens":444,"total_tokens":7861,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":384,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"C"} data: [DONE] @@ -132,41 +172,61 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 17.82585s + duration: 8.489713292s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/robots.txt + url: https://example-files.online-convert.com/document/txt/example.txt method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 30 - body: | - User-agent: * - Disallow: /deny + content_length: -1 + uncompressed: true + body: |- + TXT test file + Purpose: Provide example of this file type + Document file type: TXT + Version: 1.0 + Remark: + + Example content: + The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. + + John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. + + Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. + + + + File created by https://www.online-convert.com + More example files: https://www.online-convert.com/file-type + Text of Example content: Wikipedia (https://en.wikipedia.org/wiki/John_Doe) + License: Attribution-ShareAlike 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) + + Feel free to use and share the file according to the license above. headers: Content-Type: - - text/plain + - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 891.455959ms + duration: 191.441792ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30327 + content_length: 34932 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_DrHW4u4iTI0tW9Yd0T9Y3zfb\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://httpbin.org/robots.txt\\\",\\\"file_path\\\":\\\"robots.txt\\\",\\\"timeout\\\":60}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 30 bytes to /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool/robots.txt (Content-Type: text/plain)\",\"tool_call_id\":\"call_DrHW4u4iTI0tW9Yd0T9Y3zfb\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_vdFm0lObjnIFZhcKuIVkaK3y\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool/example.txt\\\",\\\"url\\\":\\\"https://example-files.online-convert.com/document/txt/example.txt\\\",\\\"timeout\\\":120}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool/example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"call_vdFm0lObjnIFZhcKuIVkaK3y\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -182,13 +242,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnu3wbd4gnfJOtCvqtc3zfwgoONC","object":"chat.completion.chunk","created":1761219375,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"lGdopePQNk"} + data: {"id":"chatcmpl-CTtDby04hgHFgU5F6yWAiBT5mHPyn","object":"chat.completion.chunk","created":1761239807,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"ORVMoRQpAY"} - data: {"id":"chatcmpl-CTnu3wbd4gnfJOtCvqtc3zfwgoONC","object":"chat.completion.chunk","created":1761219375,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"E4Ktb7T5"} + data: {"id":"chatcmpl-CTtDby04hgHFgU5F6yWAiBT5mHPyn","object":"chat.completion.chunk","created":1761239807,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"qNBydxSF"} - data: {"id":"chatcmpl-CTnu3wbd4gnfJOtCvqtc3zfwgoONC","object":"chat.completion.chunk","created":1761219375,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"TRfp8S"} + data: {"id":"chatcmpl-CTtDby04hgHFgU5F6yWAiBT5mHPyn","object":"chat.completion.chunk","created":1761239807,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"9QJEyk"} - data: {"id":"chatcmpl-CTnu3wbd4gnfJOtCvqtc3zfwgoONC","object":"chat.completion.chunk","created":1761219375,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6554,"completion_tokens":4,"total_tokens":6558,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"U2M1W"} + data: {"id":"chatcmpl-CTtDby04hgHFgU5F6yWAiBT5mHPyn","object":"chat.completion.chunk","created":1761239807,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7518,"completion_tokens":4,"total_tokens":7522,"prompt_tokens_details":{"cached_tokens":7424,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"hsyHW"} data: [DONE] @@ -197,4 +257,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.783744625s + duration: 2.064886625s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml index 3b43fa5e608eacb68c187241766409c50499e54f..f2ead9a6600981244bc21be57cf9539d0408da20 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 750 + content_length: 794 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://httpbin.org/html and tell me if it contains the word ''Herman''\n \n\n","role":"user"}],"model":"gpt-4o","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \n\n","role":"user"}],"model":"gpt-4o","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' headers: Accept: - application/json @@ -24,35 +24,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"N1lf6hhTgWgraH"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"T2NRDyJsazEgSs"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Check"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QlFpSQXF83E"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Check"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"xYzfRSeoaay"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" for"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"VdyxIkF4osMS"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" for"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8JVQvxu8J8s0"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QUoalmBgvG50C9"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"WiBGSIki8xWYi2"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"H"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"o36kMNmcnwZN4wk"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"John"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"19Z6Poq046D8"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"erman"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"2IfWziBeSSR"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Doe"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"q5ESXaM8xhtq"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zhEcVq5O8OkC4VZ"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"32AdoVGFUOENc6z"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"kGj7O6Qera58F"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"RmPIhItnfHCdW"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" http"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9Fb5KYCHkqo"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Example"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"N35p8nx6"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"bin"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"AeowYwz6rqaqP"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" HTML"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"tNhxO5JCKkb"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":".org"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"pWlTlkPKhrcL"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Content"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"f1r2Z0BQ"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" HTML"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"88u7AfsfnFo"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"jtSNFy8TBx"} - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" content"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bOSmAnM8"} - - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"qOTbnuueOT"} - - data: {"id":"chatcmpl-CTnu51asNUryDd304s9TagDNB7Ys6","object":"chat.completion.chunk","created":1761219377,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":146,"completion_tokens":12,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"lVSPLHmhrs20E"} + data: {"id":"chatcmpl-CTtDdjCDF8XD1W9DZ97SRlJ7bByXN","object":"chat.completion.chunk","created":1761239809,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":153,"completion_tokens":10,"total_tokens":163,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"czi99U8I0blIt"} data: [DONE] @@ -61,15 +57,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 501.958ms + duration: 570.353583ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29903 + content_length: 34403 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -85,47 +81,61 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_6Mnl4lmzFlyldXYs2OrNtOtS","type":"function","function":{"name":"fetch","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"CTtY5B3pLEv"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_pnso1DAxvYqdr7TvHqc9kcHr","type":"function","function":{"name":"fetch","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"oVT3VtJbliO"} + + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"cYtdI6FVRMZaULM"} + + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"url"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zG5al4ZevHH7K59"} + + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ElIqEx1yr08l9"} + + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"https"}}]},"finish_reason":null}],"usage":null,"obfuscation":"25Dc0I0fQjRaf"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"vswXZPsIvDrQ1IT"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"://"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5MlcBWtO0YPKpwJ"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"format"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Mrs411xnll10"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9yyZgrocoEa"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"0q8uiOYK0td3Z"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-files"}}]},"finish_reason":null}],"usage":null,"obfuscation":"91ZGTBjahkxg"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"text"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EUQHnBr9Cn0BYz"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".online"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ElTj6qHMsox"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"46KFb2Biwhk10"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-con"}}]},"finish_reason":null}],"usage":null,"obfuscation":"viYRUziGLo8zWS"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"url"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PfW9L7mpZyUw8U4"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"vert"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kmPkc0udpoNR9f"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"npWMxeQ1HnMf0"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".com"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hm5VdHeVXJiBFD"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"https"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7WkSFvbwDV7gf"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"://"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1YY1g43jeDmNLdr"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"website"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3ErY92FQXMv"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"http"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SrD1E7pK58U8WK"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/html"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m4DCmH0gTpEwu"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"bin"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bnGirbE4Ln8uzCO"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rBvHcMcgYF"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".org"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KPuSDoOJylAWh0"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".html"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MIVI6BVEVKJGd"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/html"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Zkwg41erwdxlG"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"OFFEQk0v6IdwZ"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"18e5GIH984hC7"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"format"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2ICTOvcBUOwf"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PF9nZDYGLX9"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"9BHYt7LPw7QIA"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SHTd44TfDRHXdqD"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"text"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TuGqEYnFYw2gmQ"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"30"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"YW13RudtYKQuC"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9a3oQBZVD4N"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lg1TO1JL0lK0Jx7"} - data: {"id":"chatcmpl-CTnu5tkhy5kQi4B5syO24gTghGWqB","object":"chat.completion.chunk","created":1761219377,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6484,"completion_tokens":163,"total_tokens":6647,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"yp2G"} + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"60"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"u"} + + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtDdRghxzVwdDXDmhm5X1lwDNB5X","object":"chat.completion.chunk","created":1761239809,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7424,"completion_tokens":170,"total_tokens":7594,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"f"} data: [DONE] @@ -134,53 +144,86 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 5.094267584s + duration: 4.857454792s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/html + url: https://example-files.online-convert.com/website/html/example.html method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 3741 + content_length: -1 + uncompressed: true body: |- + - - - -

Herman Melville - Moby-Dick

- -
-

- Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency. -

-
- + + +

HTML test file

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ + headers: Content-Type: - - text/html; charset=utf-8 + - text/html; charset=UTF-8 status: 200 OK code: 200 - duration: 294.819083ms + duration: 73.624583ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 33784 + content_length: 37235 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_6Mnl4lmzFlyldXYs2OrNtOtS\",\"function\":{\"arguments\":\"{\\\"format\\\":\\\"text\\\",\\\"url\\\":\\\"https://httpbin.org/html\\\",\\\"timeout\\\":30}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Herman Melville - Moby-Dick Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency.\",\"tool_call_id\":\"call_6Mnl4lmzFlyldXYs2OrNtOtS\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_pnso1DAxvYqdr7TvHqc9kcHr\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/website/html/example.html\\\",\\\"format\\\":\\\"text\\\",\\\"timeout\\\":60}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"tool_call_id\":\"call_pnso1DAxvYqdr7TvHqc9kcHr\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -196,13 +239,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuBpOFSdtZfTMBYANWff7I4Q1sc","object":"chat.completion.chunk","created":1761219383,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"YiuSxcF3EM"} + data: {"id":"chatcmpl-CTtDiRG73WwMIj9cdncHp6m1a899x","object":"chat.completion.chunk","created":1761239814,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"O0ILqYZlgP"} - data: {"id":"chatcmpl-CTnuBpOFSdtZfTMBYANWff7I4Q1sc","object":"chat.completion.chunk","created":1761219383,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Yes"},"finish_reason":null}],"usage":null,"obfuscation":"pL5t7xP1n"} + data: {"id":"chatcmpl-CTtDiRG73WwMIj9cdncHp6m1a899x","object":"chat.completion.chunk","created":1761239814,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Yes"},"finish_reason":null}],"usage":null,"obfuscation":"L87ITd3hw"} - data: {"id":"chatcmpl-CTnuBpOFSdtZfTMBYANWff7I4Q1sc","object":"chat.completion.chunk","created":1761219383,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"EKxdlc"} + data: {"id":"chatcmpl-CTtDiRG73WwMIj9cdncHp6m1a899x","object":"chat.completion.chunk","created":1761239814,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"bjiltO"} - data: {"id":"chatcmpl-CTnuBpOFSdtZfTMBYANWff7I4Q1sc","object":"chat.completion.chunk","created":1761219383,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7347,"completion_tokens":202,"total_tokens":7549,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":192,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"0"} + data: {"id":"chatcmpl-CTtDiRG73WwMIj9cdncHp6m1a899x","object":"chat.completion.chunk","created":1761239814,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":8018,"completion_tokens":138,"total_tokens":8156,"prompt_tokens_details":{"cached_tokens":7936,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Z"} data: [DONE] @@ -211,4 +254,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 7.678597541s + duration: 3.770433708s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml index c1f60ce33a8789fc13188c690361d88721cbb052..84bf34e9a702ffb13cb7f711f2fbe4783d596a8d 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml @@ -24,29 +24,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZINmRbKBItx88K"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"4yaLCeleslhRL5"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Using"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"GAzOdW7vi2f"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Find"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ufYOxTNvcbVW"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Glob"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"RIqOr3BFDFZ"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" ."},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Tx5Q6tEvuu9R1j"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" to"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LYuomONhKplCp"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"rA2k0CPhHqtp7b"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Locate"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BiynOXg2z"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"SejSyFeX9q"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" ."},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bQmLmhZB1XepFq"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Using"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"nBTvqCz8Hs"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"q7xuhGjBgtBOp6"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Glob"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"AVJFmSQbptM"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"w7PStVf5Wx"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"p3x9ejo5atnDM"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QNOgXG8wqnxd0"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Current"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"mq22wtvm"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Directory"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8UmcRU"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Directory"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"DuEAja"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"RPPosRxQ2B"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"LDCmwexYUT"} - data: {"id":"chatcmpl-CTnuINiF4D4FjTt7vDwDkDDz3KeKX","object":"chat.completion.chunk","created":1761219390,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":137,"completion_tokens":9,"total_tokens":146,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"QLXTTcbD9gawzC"} + data: {"id":"chatcmpl-CTtDm4otTZ8FNdnGEzovbkXZZQcsB","object":"chat.completion.chunk","created":1761239818,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":137,"completion_tokens":9,"total_tokens":146,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"khOybWsMKpMvvl"} data: [DONE] @@ -55,15 +55,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 502.23825ms + duration: 435.076458ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29865 + content_length: 34321 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -79,23 +79,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_NlGpSHFtFQbqnW8h2dSL19Pt","type":"function","function":{"name":"glob","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"zIfgXbCfh4U0"} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_W8JzYLFEDogsk0zhVrn57H9m","type":"function","function":{"name":"glob","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"2YoSoHqNgsoX"} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RNbm5MZuFLBa8KB"} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"f9bU2DtQ9g4nDog"} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3YQYWYHRYga"} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wzYyA9wuLex"} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"7nvDljc2ly6L1"} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Hm1SfmU4YBE7f"} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2DmjGdvpZpxXd0q"} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7EayzrAKMke3MjA"} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuJ4tADPdvPBUvuwGIFnEeausoP","object":"chat.completion.chunk","created":1761219391,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6474,"completion_tokens":151,"total_tokens":6625,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"4Uui"} + data: {"id":"chatcmpl-CTtDmOYLJ7OeeQvQI3BVyxTlXTQsp","object":"chat.completion.chunk","created":1761239818,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7407,"completion_tokens":279,"total_tokens":7686,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"7"} data: [DONE] @@ -104,15 +104,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 5.2708905s + duration: 7.853742875s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30159 + content_length: 34615 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_NlGpSHFtFQbqnW8h2dSL19Pt\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool/main.go\",\"tool_call_id\":\"call_NlGpSHFtFQbqnW8h2dSL19Pt\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_W8JzYLFEDogsk0zhVrn57H9m\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool/main.go\",\"tool_call_id\":\"call_W8JzYLFEDogsk0zhVrn57H9m\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -128,49 +128,49 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"gR75EkGHNa"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"kUyzsqf9Bi"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"YgTFIAYEs2F"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"VHSTMxNx757"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"tsDItu5j9"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"yWEa5M8tr"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"qd5Komr7D"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"HSRXs0Cin"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"qeOdrfGoa"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"a9sykVvya"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"FK11wZb"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"jChEd26"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"H4yxkHK"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"95kHTq0"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"iEyxm8y"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"O5IU4PI"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"XB1BJTi"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"wZoGQDw"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"icYhpVa"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"KI3EK4z"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"Bq5imswq5D"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"PI2LqNRJwf"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"TJdakHVWWN"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"f2vgIaOXug"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"2qyG4KsyUg"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"hIjpWFlRzY"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"3Jw0ntWJZxY"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"NJ7uQIwYnZ6"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"93YMuBqST4n"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"kFqRGU6S0EF"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/gl"},"finish_reason":null}],"usage":null,"obfuscation":"JwjLfqO2A"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/gl"},"finish_reason":null}],"usage":null,"obfuscation":"gli88U1kY"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ob"},"finish_reason":null}],"usage":null,"obfuscation":"RJW7cvrTNs"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ob"},"finish_reason":null}],"usage":null,"obfuscation":"kl6o5FpmKm"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"I6IYty6"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"o8LUp0s"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"rNjTOUc"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"Pg6P6pp"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"y7P7kku0B"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"ILS4PRtu3"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"2RCN7G"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"nrFjbH"} - data: {"id":"chatcmpl-CTnuOV5QV045mTeV2Tqm4N0cahFtB","object":"chat.completion.chunk","created":1761219396,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6519,"completion_tokens":22,"total_tokens":6541,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"MJFd"} + data: {"id":"chatcmpl-CTtDuYL8eQs9YyGVgoLFFcHIoJzFc","object":"chat.completion.chunk","created":1761239826,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7452,"completion_tokens":22,"total_tokens":7474,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"2dVy"} data: [DONE] @@ -179,4 +179,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 970.528709ms + duration: 1.898265459s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml index 63ee1cec2e5ad3dcb4ee16cb0858cc98874bee37..afc4b4d1060f03a38cb4a3263b4f716947b186ea 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml @@ -24,31 +24,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"d8cnm3R89KcjQ4"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZlZONqJdWikDnk"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Search"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MMidAmMJVR"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Searching"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"NapidHn"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" for"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"veKuGQhWvuUa"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ulW1MMlnt0BPUI"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"PcYp6bwSGEWYEh"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"package"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"oPVlY4rpP"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"package"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"TPF7UZyIl"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"iHe0vsyU7JKAsAT"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"azxHh76lf6XXQJr"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MxzC7mNEqWoWF"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"DkV7YXKOo49tI"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"xUMrv5hHV2ZTt"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"czivFmU9OOtBl"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"hSqchJorMG"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"y1WkIlT9lY"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"qwvo71OKz8m"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Using"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"V5t4ML6mkN"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" grep"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"icTjzJ18cG2"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" grep"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"qQZyIAYguG8"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"0C079dlJ7U"} - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"m37CjVMhQt"} - - data: {"id":"chatcmpl-CTnuPiS42WCMn3yxVYnQGjdF11fp9","object":"chat.completion.chunk","created":1761219397,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":10,"total_tokens":148,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"oJenwvVbKE5Ps"} + data: {"id":"chatcmpl-CTtDwWExjdFR36tBAVRCCv5IuzXH1","object":"chat.completion.chunk","created":1761239828,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":9,"total_tokens":147,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"bmamPRff6Vb6ci"} data: [DONE] @@ -57,15 +55,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 568.274792ms + duration: 538.426375ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29863 + content_length: 34319 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -81,81 +79,41 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_qGqHburh9bkOKPDNhahUudPk","type":"function","function":{"name":"grep","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"4TmhxhY0Ib6r"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"BCdOPTUvR9gmSlY"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6O7WefsoPw3VGT"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"63fSf7i7X28ucZo"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fB3himcq0XoEUS0"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Azwy3YtafGytmnF"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PC0warMO54RLlFZ"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DBpiv9yvvXIeNNT"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Cdc8Xld7cLqkq"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tTj0VHfh0q0Ve"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AN7dJvokkF1wy"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XzpnnmotRVGOR"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QZjGQqD59Wvh3"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"grep"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0mKtfdx6psNt30"} - - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yLKyfkZwSkETl"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_m6xnt318uE5EFDOjJ9Miio5S","type":"function","function":{"name":"grep","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"eVzZ3o1Vg9vX"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"isb0aq9mzT6QT"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"JncUiiuGpO2qNhT"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oJiMzcKBECo"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"teyk46DQ0Ke"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"iWSw26hjTRgfQ"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"fbYKb5detTWUD"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"package"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FBpFBGFlRz6"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"package"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6YQyYc9o71t"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"wZvYv7o0BWIeY"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"z4Xjgk0DgxSAe"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"include"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GriwucupO9M"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"include"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eJqES6bE3Jj"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"oiSvZTiegsJAm"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ofh7CE3yqVBeP"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"EgdXXEVzrJDZ6"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"2LPKOB0LXkeI2"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"literal"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DfBfuFEuyxI"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"literal"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w4iC9k3qdlQ"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_text"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6Kyq88y3xJa9L"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_text"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XR6mm2sCCcj1u"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ypikVhLBiPx07M7"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wTxY6CjbR5rVR0V"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"true"}}]},"finish_reason":null}],"usage":null,"obfuscation":"km3bQibO3WajZi"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"true"}}]},"finish_reason":null}],"usage":null,"obfuscation":"keFDobolwIcZKG"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"L"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"s"} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuPfUpZXaOiUmyoi5j4SGruVZ6G","object":"chat.completion.chunk","created":1761219397,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6475,"completion_tokens":309,"total_tokens":6784,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"r2t8"} + data: {"id":"chatcmpl-CTtDwGSBx3vIPQe3gLb1nzA5qDukZ","object":"chat.completion.chunk","created":1761239828,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7408,"completion_tokens":481,"total_tokens":7889,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":448,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"z"} data: [DONE] @@ -164,15 +122,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 8.1257235s + duration: 12.644234875s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30322 + content_length: 34711 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_qGqHburh9bkOKPDNhahUudPk\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\\",\\\"pattern\\\":\\\"package\\\",\\\"include\\\":\\\"*.go\\\",\\\"literal_text\\\":true}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_qGqHburh9bkOKPDNhahUudPk\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_m6xnt318uE5EFDOjJ9Miio5S\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"package\\\",\\\"include\\\":\\\"*.go\\\",\\\"literal_text\\\":true}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_m6xnt318uE5EFDOjJ9Miio5S\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -188,61 +146,61 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"xMi7bDXSiZ"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"gPWdKD7XRt"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"nfdvyi4Zl47"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"cOTSNzwOtrQ"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"cwuFIAQyQ"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"Vsc7PuISG"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"x0XiRakN8"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"IZlqcakM7"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"5UwSso4gr"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"8fKKXq60v"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"JVHLXGH"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"af23zPh"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"hsXg4Tu"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"dzxZavK"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"Klzn3ru"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"4uqOLvE"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"1k35coD"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"tkxsJ0V"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"OaAPYfq"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"ZG7VQ79"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"GIvt9mXsn7"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"0M0rgK02hk"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"D4Kdj9x9LC"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"OxuMQQlezc"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"R0s0LLIkGW"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"gCJqasbGyf"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"NYpDEzRBu9u"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"o1ZvwWSoNCE"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"e2dsudPSHSy"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"rvAL39Qm3zx"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"tFLEf3q0CEL"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"bUfC7uYfF8B"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"grep"},"finish_reason":null}],"usage":null,"obfuscation":"8bxDpKkI"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"grep"},"finish_reason":null}],"usage":null,"obfuscation":"xttQi8pA"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"Z2cArGo"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"TWmU7qO"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"D81ujGr"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"VPCaEj9"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"OaM2L9Qvs"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"gW3GMizGb"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"F77g5lzT7ya"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"YO1jSscMDfH"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"dsosfWfPafW"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"7AfuWNBSTW8"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"vfDTOaznIQn"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"KGZ4R6nhDKC"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"ArhywxjgIDW"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"LarkcnZNISG"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" package"},"finish_reason":null}],"usage":null,"obfuscation":"j2vj"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" package"},"finish_reason":null}],"usage":null,"obfuscation":"71YT"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"NgZUBVt"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"H94mrUR"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"COn5Vw"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"94EbDO"} - data: {"id":"chatcmpl-CTnuXkApsWyjgU4YqPGrFOknm3jF6","object":"chat.completion.chunk","created":1761219405,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6568,"completion_tokens":28,"total_tokens":6596,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"RtYb"} + data: {"id":"chatcmpl-CTtE9Xfyq0Jx8mH4ToRSfzhVnsr0G","object":"chat.completion.chunk","created":1761239841,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7481,"completion_tokens":28,"total_tokens":7509,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Bcki"} data: [DONE] @@ -251,4 +209,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.274488666s + duration: 1.676791292s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml index 3c709a720e1b8729eb81a02bf0c638977f7117c2..3a99dfbbd2c7c282d089bd75c9545baf29fa19c1 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml @@ -24,25 +24,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"tZFC45ICW7Zb5a"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"PalM51LRS5KgZ1"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Listing"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"jFXWqSVmx"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Listing"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BTk48uShZ"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zPx0lsAxdr"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"mfPGKyyv6c"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LZxVVe0LQhr"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Aio4f3HyxYpQe"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"yuOdTDLD1TDbFU"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Current"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"PsWvnTXn"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"ls"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"dpSE6c3ZolPut5"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Directory"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OZPtjq"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QHyjjxU1VDSO0VZ"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"mOG1ZpCOPXA"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Command"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"hUgh65Lu"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"AeTmgInLh1j4FE"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"TPmpN0XDo3"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"ls"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"t1gFRu0TpVo37g"} - data: {"id":"chatcmpl-CTnuZ2SW0SaZmoH7AiqWV4u6fgTh9","object":"chat.completion.chunk","created":1761219407,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":135,"completion_tokens":7,"total_tokens":142,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"TrHgcXEGzlYBS8"} + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"CrKtF2l6n5fJYjS"} + + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Command"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"NuXZpQtt"} + + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"v7UT7bSRqL"} + + data: {"id":"chatcmpl-CTtEBNFHnbbQOo6IfIngT3drXmBNC","object":"chat.completion.chunk","created":1761239843,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":135,"completion_tokens":10,"total_tokens":145,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"AIdW96yZKuXGr"} data: [DONE] @@ -51,15 +57,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 638.803958ms + duration: 1.095213s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29857 + content_length: 34313 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -75,21 +81,61 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_Elf9zwpU7JL6BiwAUVM82C1z","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"Ts5sWl36Aw36xr"} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_izTmj9hqjhkFOWTIRU6Rdmmr","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"f9e8elBFmIZyrC"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"QvAsgG44q8zQEAu"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4jbCFJbNstZwDg"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"06rZxX9kBKJhmEq"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jSRILshpkE82Fbh"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z4kuJkitrpPvRji"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yaeqYsZj7h5M24t"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tAlta632fcu8I1a"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x7qrUXJcVAYJd"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IENOAvPABZWMU"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TOzXLimtdRlfa"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CEK7s6fvpkHhT"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kfbQB22kMdR7g"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R"} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ls"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cm1fncX3hPrcY"} - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"hExulYfByjk9jWe"} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"1lgByQRZSDar9"} - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5ZTtxJimxFViMy"} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h3c6WPevixqeh"} - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fqFaBSl9qNBEUb7"} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h1uxxKaS7IL4naN"} - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \".\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"V6UWbyP33dn9"} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"1"}}]},"finish_reason":null}],"usage":null,"obfuscation":"O"} - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6"} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N"} - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuZtJMMJvm311RO10X5sEBoBBoI","object":"chat.completion.chunk","created":1761219407,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6472,"completion_tokens":215,"total_tokens":6687,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":192,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"4Wmn"} + data: {"id":"chatcmpl-CTtEBriReIKWiip9Wxsk2WpAXZMKy","object":"chat.completion.chunk","created":1761239843,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7405,"completion_tokens":107,"total_tokens":7512,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"aO"} data: [DONE] @@ -98,15 +144,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 7.094167958s + duration: 5.140031916s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30166 + content_length: 34683 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_Elf9zwpU7JL6BiwAUVM82C1z\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_Elf9zwpU7JL6BiwAUVM82C1z\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_izTmj9hqjhkFOWTIRU6Rdmmr\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\\",\\\"depth\\\":1}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_izTmj9hqjhkFOWTIRU6Rdmmr\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -122,21 +168,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"ng5JXt8d5w"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"5ocFJKVcdu"} - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"M32vNyjKMt"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"CaPxD6YgLr"} - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"4eazwHdr"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"uz1tWD1H"} - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":","},"finish_reason":null}],"usage":null,"obfuscation":"GbRz2IIwZxW"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":","},"finish_reason":null}],"usage":null,"obfuscation":"53kdzSg176q"} - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"hL5IhJ1"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"qnIA0hO"} - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"5K3oomxnQ"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"SJDNKQCDL"} - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"j1AUxh"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"c4OsJk"} - data: {"id":"chatcmpl-CTnugI4UtWkVJf1hMoD7JIcEzUhfM","object":"chat.completion.chunk","created":1761219414,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6529,"completion_tokens":8,"total_tokens":6537,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"x7eIs"} + data: {"id":"chatcmpl-CTtEGa4CVjBdkssPehobbMQMoUH48","object":"chat.completion.chunk","created":1761239848,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7482,"completion_tokens":8,"total_tokens":7490,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"UY9OS"} data: [DONE] @@ -145,4 +191,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 971.224792ms + duration: 2.191894875s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml index cab71687fb118c44e60bb6055eb77dd28ba65447..388d5530caf0f3069a23e5553c3929211476c91b 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml @@ -24,29 +24,41 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"G1vYR2Yb0RBwDS"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"RMS5H5cRfUepWl"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Edit"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ReCqcIFdlgeB"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Change"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"E1Z5UaMUfM"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8bZtr3W7Er"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LjlpjSB5Gj1E0F"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Message"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"0WwcqvRj"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"NWj8MZ6ybb4"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"v8qseZ3ccGJk"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":","},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"jzXZAvBl5YGs8SU"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Add"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"1wO46M3JOP5N"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" World"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"pW8XoiTlk5"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Comment"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"IrNKj1yT"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"!'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ECnh7iWuEDk7FI"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"r1GqEBxGY6esY"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" to"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8ehi3Cl8TZA8W"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"HJm3ej2BlEz"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"c2ebilBBmZZmci"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":".go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OtXfMAJLLej2y"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"svklZDVIumf"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"8NMqR5O0Ut"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":","},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MkdDifYEeQqwYv0"} - data: {"id":"chatcmpl-CTnuhUejVhrVn7z96Ws5FlZr04xCt","object":"chat.completion.chunk","created":1761219415,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":157,"completion_tokens":9,"total_tokens":166,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"E0L1TPWsfwAEhV"} + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Crush"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ShDGoIca1x"} + + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"!'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BZ5vLkiYKlp1Kl"} + + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ooexEULB6qVxt"} + + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ckChEkXehEV"} + + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":".go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"I987h2debxk1s"} + + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"GFYzmrcIMt"} + + data: {"id":"chatcmpl-CTtEITgwnnObe1N9ZvM4xFh2Sqprm","object":"chat.completion.chunk","created":1761239850,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":157,"completion_tokens":15,"total_tokens":172,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"4ydBp6iaNXxTp"} data: [DONE] @@ -55,15 +67,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 459.876666ms + duration: 438.27125ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29943 + content_length: 34399 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -79,31 +91,69 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_I1pqDnM1TWQB4HuafXT8Nfy9","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"7J4H9megt3uMwJ"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_xTNBI5klQVkePhk3MPdASmCF","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"hwCnlHEmazQAp2"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"MwOH1I6MORosnOh"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oT9ZGhfHMti3Ep"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"g1f8HnczIZca4he"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Papnp3Ec2EF0x0"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UAuP0WdYXBIQoar"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oBEDTsqYn8C28kQ"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3RSPFIWDfEpUa3m"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3FLqIvVvIdgRH"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2k9ejZGSq5GHs"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"agExJoetonDee20"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wLmNmuHay9H1s"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wHXqFNJ0dtXYQV"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TVVNeh96anZfA"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aFm2pM78O7eTXLV"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ctq0JZ9PIIskK"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"rxRbuIXaQm5s"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"PN9YbHnMJzBua3j"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9nlK6byWb0QIW"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PIJqFD1EmF0gQDP"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"n"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"O"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"M"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"76CJYnRymRFTlNd"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zSpc5E4r7SpssjJ"} - data: {"id":"chatcmpl-CTnuhMRKh33EPuGe3o5MAD5KOLCc9","object":"chat.completion.chunk","created":1761219415,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6496,"completion_tokens":220,"total_tokens":6716,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":192,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"5VWy"} + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dFXSbanBKsoiX"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"cA3NTJ8JixWWpwv"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"4JbTrlgjmt8Rpww"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ImumkY1GtdwCu"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IzQ3IudTw3iUkDT"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"1"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"M"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r"} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtEIdmAKnH8Vo3lahJmrrr1hm0nj","object":"chat.completion.chunk","created":1761239850,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7429,"completion_tokens":943,"total_tokens":8372,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":896,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"0BdL"} data: [DONE] @@ -112,15 +162,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 5.791229709s + duration: 32.811026416s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30272 + content_length: 34786 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -136,63 +186,63 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_BNSQsI4vcwCJHudYZPnlzacU","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"dbsm60mUtFOJ"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_Mwu60LXuVNgFguQslMsTXsAO","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"5T8OhAyuURSU"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"dp0m6PpNNjrsMXL"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"IjsVuPojuC6J04e"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jKalXmgEsGvRbx"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"udZsxs8wbR9xI7"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AYIyH0uWhzyIW"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8eXi46wsRTBFT"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"exBiEiYtA2TV6Fy"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nZK7tlk1zhtM1sU"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Uf7aBMr2lvMqt6o"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bVZM0QN5NtddgjV"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ID38yz20p7egp0G"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0n0igIcT5sn7c4A"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ndCNdUzkSbA18p0"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cnjgkaiDTV8dt71"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WAXTjg4IYcSvgle"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kFVzA85qVOUvvpQ"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4sgIA8DP761WL"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c8H4qjSEKN3sS"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uARUJmQm6FyfX"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TBxtepIp4GBJP"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xG70qLa2rbT0l"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IGr3YRLKEewhp"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0ijuC1Bxnavce"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BnPV6E0qn7mCJ"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MvxRfqBYOZWpR"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ptuP31huMeJ8K"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"q"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"s"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"L"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"onGCjOvVcY00QTT"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8wQIyANEMRl7eVv"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1Nvg2gUq24j9a2O"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c3w1SPji6MfmqTn"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z9lkasmPQgD5s"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H8qAv04YsAo5t"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nAT6xRBE1GEHl"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IJTVvO6gxPMUq"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d7oi3J4NsdZDyCv"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GcbtBhnw3Tbqdqh"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UcMBGGBTBOkLJ6a"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jg1wKAK4eeDf4a3"} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnunS0yO8jAM3EPGelBeSUbFLY5c","object":"chat.completion.chunk","created":1761219421,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6557,"completion_tokens":37,"total_tokens":6594,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"F2kO"} + data: {"id":"chatcmpl-CTtEpfdXRzIRvoVzKvMKucr0f8b0U","object":"chat.completion.chunk","created":1761239883,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7510,"completion_tokens":37,"total_tokens":7547,"prompt_tokens_details":{"cached_tokens":7424,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"mycn"} data: [DONE] @@ -201,15 +251,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.339392458s + duration: 2.097811083s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30721 + content_length: 35235 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -225,249 +275,193 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_a4kxZbiotTZsM3aIqLs1TIYS","type":"function","function":{"name":"multiedit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"izjgR2y"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"yaARuOQM6NWeQgZ"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mH3KAOKWNaYSQc"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f6R97GaACwluc"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JmYrBmC1sUnEINf"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_MWl21hHnVrtVZUIWH8PfwrWN","type":"function","function":{"name":"multiedit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"fvyXAje"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"quumMPs9jcWXqg1"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"gFt8z67OqurF2gQ"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WApqdQnmqdRMW1Q"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"roJz30QTspAgZs"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KCCVoxyo3c2h0J0"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dfqJ5Lun7cxBY"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Tqoc98epwFahUQT"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3O821fdSHPfnTSt"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qZSa7LaFnMgeu"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hCyC4yDYAO32VLe"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q5zI7HALAIDUA"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"22izP4syemH4QL6"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sEFeeMoUyz8DQ"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PzoRpiNcgVrdQhm"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lcamp73Q7gYzB"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xzLnyquiqDOnw1p"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BsPq1DCU73M8g"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mmh9OFmzNt3tq"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AOWsDTisJYMPs"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CYPzziEkgrrIa"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MWRwgXaJRRf0M"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"i"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vwgQRhzFOE4MR"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ElHVM5gv0ssnKpR"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"98R4m0IQAZs4I6a"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"L"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VvkfaGjnL42QU"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jMeA3QAnBHcho"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tsJVhoU3zCcwHfW"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bkTFtweKkHBTkFI"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1igy7Z66hhmg7OJ"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"YjJHnr8dynyI8"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ed"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aBaWLNJdhQL4E"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"its"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dP1ggR0cgBj84EB"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7FDZcl039xpEe"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":["}}]},"finish_reason":null}],"usage":null,"obfuscation":"99vEOKbZAK7zVW"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mNeyITitHNUONK8"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"MUcBp8T8bKD5aBE"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZMJtLYBZVqM1Y"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kqcpJ8kcYMxnA5u"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ed"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dZyiOdQxLuU"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"its"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yIcR9q5gkqdZLBq"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"m98cvO7QBaobv"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":["}}]},"finish_reason":null}],"usage":null,"obfuscation":"viT51kmTlp4wDL"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"G7yLCHGQmVuHIA"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"bZlDSN0gXPjL51n"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3LlECcYNTKHMy"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8x5nNaVToSFQzOH"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DmMh2E9Tul7"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mNP35pebZrxFpH"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"wMSJ67DRFYkkA"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"66F6CpR0YlI16ac"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tf"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LPCQFvZV9sffAnu"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"mt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DzeotZIuh7"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WEpAOoxT3c"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"L2BVPRo08ProR"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"niWG9fArvBpUQ"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P6m4FlTaC0KWc"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yrrYsLcB0giAR"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"0"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"8"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KkyygJPhQBYT"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N2xAZB4iPse5"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AlTLdC2jBrdLfNP"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WUDpomhRozEhEcz"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tBzz6EWT2PpgtoC"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JzgRqurCiMnd9Nr"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"kZjyUbi5PXQzI"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qW3CEi44nwADAbn"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pZsKULDkNsk"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"nlpp0dY78lADR"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"zV9Bt1KeFIwTY"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2njlOwSBznngN7N"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vY60Cc6V6Br"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tf"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"V5UPty5nk2xVn"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"mt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Gkp9ElzkENIm9f"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DoGQXpHQVM"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1TtmoXY1NuHUU"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"mpSNRIf62MlR5"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d0r1s5icBNLIy"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r2dZZVgPdu1VVF"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"g"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OHBp0E9fxtib"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"owrNqr27VkLremw"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ElMk2MlP8YV5Rtn"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OifhxnUUtmVOTHo"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OSzjnJFsaGdW9aF"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"72v4kEQnU0"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"},{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"JqmP4jcf1y7"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"6oLkjnbwagbGz"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"th6FhE1IXnneRC0"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7zNgikeJLR0Q9"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FliBfeqiOk6"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"3"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"SELU4tPZAtlP8"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ufeiG6itlvX8"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mxmRiBKmr6l1HXq"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tf"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q9CPtiUdcbQe7XY"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"mt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OsiPgm2Ym4"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"1aPCySsCb8B97"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"9KXJdjNQTY3gY3D"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bwXSOOP3EqWeg"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"},{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"87bTlegiPI4DK"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"s"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c3zJQKjWDBFhoX6"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wrfuYBTLWNKb"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mnjvLwI3gyf"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"veSycuLQKM0ocBc"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"DBKyC8QGxoq5o"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yUNullcrBAf4yIm"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"E4LXfTr2hjbpWZ"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"8NdnZ2fJdykLc"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kLwq8fAnA1Nhl"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IsDq4ybbIHUUoVs"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PWY9tbrq16l"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"97wNbZbA9agddm"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"UNxTX68DXLuPq"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qZMxMpZ7do6AiQt"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"q"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"34T2nFrItljqUnZ"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"//"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zh6hMLHfUA"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Greeting"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vuc7LDXkW"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"69YJeEI2nT9do"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wcXHWoX2LYh1kiZ"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZN0nhEU2WpRRY"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"v4v44mcPnUgfWgw"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"i"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bC7LLlItVvUXuAz"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NHUfcyL2D6cX"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"V4dUTP0nKP"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CUzwXu64jvLhCJs"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ea9MRnOpoT0Sv"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tW0206RJGvODZei"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"V8AGvZDCrBdmr"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OsLk1yLzKJ8E"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"clHAyIERXW4viQN"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ngj1KzyLwnuSQ"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"My0hhxy4pzK92b0"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iUhhpvj1bheLeKY"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gCKaX5qR3r25LsJ"} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uOHi3CfQJen"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"]}"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"NQnF7ZTz5x3rI"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2aQU9D20In1R9c"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zIGCopFyn8Tgm"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IarDaoFM0SOYK0"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1VTaWOaAIonN25V"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"//"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Greeting"}}]},"finish_reason":null}],"usage":null,"obfuscation":"De6oXIcQN"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sNAKfNIc8Lt3CEc"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4tPosXcadbMkKVM"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y5okD5mRDbHJL0m"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rm5ROq5rmm"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"y0LMLC3pkHSc3"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C2giZxA0RlmZf"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"X"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PEZiylW5fnnV"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z8wBTBnRHFd0f9u"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"84wHeBUYFcgcX1W"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"v"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4oCwpJAFsgx8SNm"} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"]}"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnuo6FCRWAESNG10XxFx9qruu9rn","object":"chat.completion.chunk","created":1761219422,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6656,"completion_tokens":2442,"total_tokens":9098,"prompt_tokens_details":{"cached_tokens":6528,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":2304,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"SSipCwL4b0cgihe"} + data: {"id":"chatcmpl-CTtEr8gl2Kw4Rt2bxUwkOWIXulxNS","object":"chat.completion.chunk","created":1761239885,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7609,"completion_tokens":1582,"total_tokens":9191,"prompt_tokens_details":{"cached_tokens":7424,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":1472,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"59UZ0c2Vu7b9i6l"} data: [DONE] @@ -476,15 +470,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 37.907893209s + duration: 36.56719475s - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31478 + content_length: 35912 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_a4kxZbiotTZsM3aIqLs1TIYS\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"},{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_a4kxZbiotTZsM3aIqLs1TIYS\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_MWl21hHnVrtVZUIWH8PfwrWN\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"},{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_MWl21hHnVrtVZUIWH8PfwrWN\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -500,63 +494,63 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_MAOXFW9Z1yjTHrVUbwrhdgDZ","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"RkWyYD0uRWRe"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_vHItW07e3DXOzl30Vb0dvwTw","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"yTRbCQBWophK"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ng4Pe9e5fsmFbN2"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"TfsMxpARFFqdZH2"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nJxVtEurm9PD4C"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aJHPBh6WonVj1Q"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jcOsoKEN5d9cT"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yzC2ptkmgULjp"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qikXdZb16VqqFQT"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T67CBCbNSBekAqD"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YvWR8iyWMJ0nTAA"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4BnMT6eNCdLGiPZ"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1P4fW3CDfanggsH"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"g1VIevfDmuxdc3F"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7nZp2OXz0BiD1G7"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RUGkoQxiEdaRKpW"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ALTgAH0BrA8Z0mE"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UByHp5t3DRVURUB"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gGXn6zbFBAonW"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2pzgw0vPe8FiN"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rcS6qmaK9QmNP"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UZCoiqzI7elKN"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yV5Hlc7jH12ps"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qpFFTsutjWPt5"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QINY6qVFpkItV"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o2NTvHOmFYKUW"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TnudXocP7gGtU"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oE6PaEfNlzy0K"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"B"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4KTumxiI3fbmcMm"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7YAFn8bmuETnsFt"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rc8yCLRkUv6cDDS"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rhbh0l8xMmVOEec"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kCSQqiEXhiwFy"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WnR5kBlNQuF1I"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yAuSto5lEh9j8"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MboSsiwHdOWwF"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5niLgnxuyOpu67t"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ChpX1wFQJCWt8Aq"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ix1bU5RP1zuarzD"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hbmJQdv6CXQ8sAF"} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvRqybvooZg3pHL0ZJn4DEafuRl","object":"chat.completion.chunk","created":1761219461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6835,"completion_tokens":37,"total_tokens":6872,"prompt_tokens_details":{"cached_tokens":6528,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"6xao"} + data: {"id":"chatcmpl-CTtFTqI2aMmKZG7BJOZ1KkYUlpqAN","object":"chat.completion.chunk","created":1761239923,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7760,"completion_tokens":37,"total_tokens":7797,"prompt_tokens_details":{"cached_tokens":7552,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"aarq"} data: [DONE] @@ -565,15 +559,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.4844135s + duration: 2.984819958s - id: 5 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31949 + content_length: 36383 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_a4kxZbiotTZsM3aIqLs1TIYS\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"},{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_a4kxZbiotTZsM3aIqLs1TIYS\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_MAOXFW9Z1yjTHrVUbwrhdgDZ\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\t// Greeting\\n 7|\\tfmt.Println(\\\"Hello, Crush!\\\")\\n 8|}\\n\\n\",\"tool_call_id\":\"call_MAOXFW9Z1yjTHrVUbwrhdgDZ\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_MWl21hHnVrtVZUIWH8PfwrWN\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"},{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_MWl21hHnVrtVZUIWH8PfwrWN\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_vHItW07e3DXOzl30Vb0dvwTw\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\t// Greeting\\n 7|\\tfmt.Println(\\\"Hello, Crush!\\\")\\n 8|}\\n\\n\",\"tool_call_id\":\"call_vHItW07e3DXOzl30Vb0dvwTw\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -589,87 +583,97 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_Q0CkA8QSKRIzRVl4xl37sxzS","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"fx9kYN2x64Uo"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_jtJHnjhqcBOyGqvB7a4MSPjl","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"q84CUsyqqalq"} + + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"qPLUtco42Al2RMv"} + + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DOAWikIsJxr"} + + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Wzgp44Zemqcrx"} + + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vy44yahjdE2vcw"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"tTW88Muso6gMNbw"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YhzEPx5747e"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fHdPe0AiSXh76fc"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"UOMNX7tpDzEsl"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6fxiRfw8I0uL7nr"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r0IU42obg6Wcafc"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N16w911BlQvKTE"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m4gUD9bzjtXkh"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ls7tmFe7hMkte"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uRIoJWAwpaK7osU"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T4MA7b2yXbAs2"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AAhGrB9GLNURy3k"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OpUltWz6r0fnT"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PTbKfSA5flUkZCe"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qn41LRpwAgV0T"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IPQ3NxfiCpti0"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DW4468SgFRxcX"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7COTDS4X2u2tr"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iO1MVsLQS31cF"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YUPLT6sppw8YN"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"U"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P9ZAIyaNMvIS62s"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m08YH0Odpws994M"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BkGN9UAjwRyTm"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zG9c4tuPU0fzb"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JF1HuvPj8PmjgoJ"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NtwwlXMBFxUVjdz"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QmWeo7c46B48GqT"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"8ANj9PaQfmrkL"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LyatVhl"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ER25C2CHZbh7f"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"4mrCdKAO1ks9n"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"guua4msWWuEa5"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q55pEAMgNHojLhL"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zViBQMknb5012pr"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b5oo9KuiDInFmf"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"kSK9Gkg9aGvAn"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QDElBOdgYp3nxNQ"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n24IPQn"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yOgq8MLoHV"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"HcMkw1iVjqZaI"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CTakkG2iZWcHhHf"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IXAGUJGpEksF5lY"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" ensure"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m7SZnE0SeBv"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jNwrIar7EPLt8b"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" it"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gDvNmM0Krk792UT"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bzRjRtbuHS9bQOo"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" builds"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CY0pr7fQAnV"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ICSINrZSmU"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" and"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aB9XWlYHj7ztuJ"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fiKA0x0NPv6RXFN"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" outputs"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kDhLXcsFH2"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IJf9UKytcg86N"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8oOZWugsEzeqTo"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fBUCwLAfnjqaoZ"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" expected"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9EXuhxT3X"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" output"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Oxymj186SMV"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"q42zRcq7odv"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7qbzMcEIRdCP1JE"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iGsLbE9gDV296qY"} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvTcFkCzIJS6b3vSpmYhvZs1Fzx","object":"chat.completion.chunk","created":1761219463,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6942,"completion_tokens":50,"total_tokens":6992,"prompt_tokens_details":{"cached_tokens":6784,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"pjzW"} + data: {"id":"chatcmpl-CTtFWepTqZXTkoqUzRsdEZEgyGMyN","object":"chat.completion.chunk","created":1761239926,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7867,"completion_tokens":55,"total_tokens":7922,"prompt_tokens_details":{"cached_tokens":7680,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"AJPY"} data: [DONE] @@ -678,15 +682,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.076505458s + duration: 1.816222458s - id: 6 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 32397 + content_length: 36864 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_I1pqDnM1TWQB4HuafXT8Nfy9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_BNSQsI4vcwCJHudYZPnlzacU\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_a4kxZbiotTZsM3aIqLs1TIYS\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"},{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_a4kxZbiotTZsM3aIqLs1TIYS\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_MAOXFW9Z1yjTHrVUbwrhdgDZ\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\t// Greeting\\n 7|\\tfmt.Println(\\\"Hello, Crush!\\\")\\n 8|}\\n\\n\",\"tool_call_id\":\"call_MAOXFW9Z1yjTHrVUbwrhdgDZ\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_Q0CkA8QSKRIzRVl4xl37sxzS\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"description\\\":\\\"Run the Go program to test the output\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Hello, Crush!\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\",\"tool_call_id\":\"call_Q0CkA8QSKRIzRVl4xl37sxzS\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_xTNBI5klQVkePhk3MPdASmCF\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_Mwu60LXuVNgFguQslMsTXsAO\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_MWl21hHnVrtVZUIWH8PfwrWN\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"},{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_MWl21hHnVrtVZUIWH8PfwrWN\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_vHItW07e3DXOzl30Vb0dvwTw\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\t// Greeting\\n 7|\\tfmt.Println(\\\"Hello, Crush!\\\")\\n 8|}\\n\\n\",\"tool_call_id\":\"call_vHItW07e3DXOzl30Vb0dvwTw\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_jtJHnjhqcBOyGqvB7a4MSPjl\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"description\\\":\\\"Run the Go program to ensure it builds and outputs the expected string\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Hello, Crush!\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\",\"tool_call_id\":\"call_jtJHnjhqcBOyGqvB7a4MSPjl\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -702,13 +706,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvWWSTS3wNS3gZo5WnCPjP6RyID","object":"chat.completion.chunk","created":1761219466,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"q3GU2fbheu"} + data: {"id":"chatcmpl-CTtFYrZspez1IfnbKJi3exo5VeFUi","object":"chat.completion.chunk","created":1761239928,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"LZzxqSj0jh"} - data: {"id":"chatcmpl-CTnvWWSTS3wNS3gZo5WnCPjP6RyID","object":"chat.completion.chunk","created":1761219466,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"VlycIjXL"} + data: {"id":"chatcmpl-CTtFYrZspez1IfnbKJi3exo5VeFUi","object":"chat.completion.chunk","created":1761239928,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"0eWODxlo"} - data: {"id":"chatcmpl-CTnvWWSTS3wNS3gZo5WnCPjP6RyID","object":"chat.completion.chunk","created":1761219466,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"t2CrqI"} + data: {"id":"chatcmpl-CTtFYrZspez1IfnbKJi3exo5VeFUi","object":"chat.completion.chunk","created":1761239928,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"Z8ZrsK"} - data: {"id":"chatcmpl-CTnvWWSTS3wNS3gZo5WnCPjP6RyID","object":"chat.completion.chunk","created":1761219466,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7030,"completion_tokens":4,"total_tokens":7034,"prompt_tokens_details":{"cached_tokens":6912,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"CsiEW"} + data: {"id":"chatcmpl-CTtFYrZspez1IfnbKJi3exo5VeFUi","object":"chat.completion.chunk","created":1761239928,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7960,"completion_tokens":4,"total_tokens":7964,"prompt_tokens_details":{"cached_tokens":7808,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"UzveB"} data: [DONE] @@ -717,4 +721,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.812447166s + duration: 2.576156625s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml index 4e10d8b8fd351ecdb0bb456be04d956de82fee59..64ce7f88916838f1ee654dc3a4922e6e012aeff1 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml @@ -24,23 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bHMVyt6xB1v0uV"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5LV8NsOVZTBmmK"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Parallel"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"jzOxYqvI"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Parallel"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"tvTcMpGf"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"nZmNYpttsFc"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Processing"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"4CGzh"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Search"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"1C5S6urQP"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"kJCFwlMLQLv"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ii9HFHKQ2lNX"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Glob"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"TsUX3Jk2jDf"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Directory"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"iRD6GD"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ia7aaLKYEtc7"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Listing"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"CDIUZSPI"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" LS"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"RJCuwRbWShWyi"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"LsrxflsNPT"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Commands"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZXgDvfM"} - data: {"id":"chatcmpl-CToEwK75TXd7qJeIzOE3pfoJSNUui","object":"chat.completion.chunk","created":1761220670,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":154,"completion_tokens":6,"total_tokens":160,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Li6hUjhsWSfr5U"} + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"SmKSijpyKi"} + + data: {"id":"chatcmpl-CTtGVuXyAVtRxCKK2X1WqX4qBlFuQ","object":"chat.completion.chunk","created":1761239987,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":154,"completion_tokens":7,"total_tokens":161,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"pUHK0PNugzkJ8o"} data: [DONE] @@ -49,15 +51,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.005567042s + duration: 397.623ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29954 + content_length: 34410 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -73,31 +75,27 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null},"finish_reason":null}],"obfuscation":"bhNo9af"} - - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_t9ds8paXUgezedpaEr7HxPPX","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null}],"obfuscation":"pS66wwZcPHIQe"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null},"finish_reason":null}],"obfuscation":"T6flyqf"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"pa"}}]},"finish_reason":null}],"obfuscation":"LuScCaSrWkAj5"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_glhpkARdWhB57HFWYryIjlF6","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null}],"obfuscation":"clHjToLnLQYIx"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ttern"}}]},"finish_reason":null}],"obfuscation":"Faze21uRmM8hk"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"pa"}}]},"finish_reason":null}],"obfuscation":"9ixFykTqZ0059"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\": \"**"}}]},"finish_reason":null}],"obfuscation":"fud14v8vkS"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ttern"}}]},"finish_reason":null}],"obfuscation":"MwEZB05JwgShS"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/*.g"}}]},"finish_reason":null}],"obfuscation":"zIcLvobaNobmgI"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\": \"**"}}]},"finish_reason":null}],"obfuscation":"DJpOkDwas4"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"o\"}"}}]},"finish_reason":null}],"obfuscation":"fCx4jGyllZupnt"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/*.g"}}]},"finish_reason":null}],"obfuscation":"znA7YYU7WzMyHa"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_ZkWUeH8iZguAbGcFxLK2zKN9","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null}],"obfuscation":"whp5aWubeKoMIj0"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"o\"}"}}]},"finish_reason":null}],"obfuscation":"V1qikp9VDkOL40"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{\"pa"}}]},"finish_reason":null}],"obfuscation":"bq2nj0xBHNlRh"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_oK3G9u3kx2pt8wjSpZf7ecvj","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null}],"obfuscation":"2AlNLx0AvMXKUTt"} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"th\": "}}]},"finish_reason":null}],"obfuscation":"oC0PTIBaRffU"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{}"}}]},"finish_reason":null}],"obfuscation":""} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"\".\"}"}}]},"finish_reason":null}],"obfuscation":"WVu5VV9lkXmN"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CToEwNewROMaaTkMHjbJIKHWe2pFO","object":"chat.completion.chunk","created":1761220670,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6492,"completion_tokens":374,"total_tokens":6866,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":320,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"kQMJ"} + data: {"id":"chatcmpl-CTtGVMM93GUQ5DpH5bU7HAQz2jyj2","object":"chat.completion.chunk","created":1761239987,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7425,"completion_tokens":372,"total_tokens":7797,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":320,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"4"} data: [DONE] @@ -106,15 +104,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 12.659725167s + duration: 8.611364958s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30547 + content_length: 34988 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_t9ds8paXUgezedpaEr7HxPPX\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_ZkWUeH8iZguAbGcFxLK2zKN9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_t9ds8paXUgezedpaEr7HxPPX\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_ZkWUeH8iZguAbGcFxLK2zKN9\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_glhpkARdWhB57HFWYryIjlF6\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_oK3G9u3kx2pt8wjSpZf7ecvj\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_glhpkARdWhB57HFWYryIjlF6\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_oK3G9u3kx2pt8wjSpZf7ecvj\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -130,111 +128,65 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"PdQnf2LmTv"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"0FPMKLstlX4"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"5JwoC51Ob"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"QGHEiY8lT"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"k2n92hXD5"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"4GsUjgr"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"sTlhVxh"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"3YHosW2"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"LbJUGjQ"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"1sZJV7T"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"wCnLHonGsP"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"b5PPC768su"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"MDSPzfW64u"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"Fs4tmxTUOCm"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"yUzmapwmkKr"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"5RL6yWPufUo"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"parallel"},"finish_reason":null}],"usage":null,"obfuscation":"VSEo"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"5QRzkm5"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_calls"},"finish_reason":null}],"usage":null,"obfuscation":"TRHZvF"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"TKOLR01"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"0y185oWwM"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n\n"},"finish_reason":null}],"usage":null,"obfuscation":"SEBZjh4h"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"7oYbkBbcMng"} - - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" /"},"finish_reason":null}],"usage":null,"obfuscation":"VunnogPswd"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"UxqeOf4eQN"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"H1fRWyY5p"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"3Qd5fNTUk9t"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"4lu7fC87w"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" /"},"finish_reason":null}],"usage":null,"obfuscation":"DHo0t4bWTL"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"c7kOPw1Hl"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"3UApf6QBE"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"cbd2MIZ"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"IKFIWY6xA"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"OUux6av"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"Cgv4gLe9M"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"TrzXT95"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"wTOEEn0"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"yTemqf4"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"oFJNHx2"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"E1SPeoq"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"ocK4meM"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"CoX4NIfVgX"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"JyepnOW"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"vPo2fMMRd6"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"erJX0k4"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"kLByTFIX6z"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"69U3IoFptj"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"vYr4uGTLxRd"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"dLZYcHvF3p"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"WWjUF9yd2TY"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"mN8N0eZ1nR"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"PDzrqFb6tHF"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"PdTH4JNVibm"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"parallel"},"finish_reason":null}],"usage":null,"obfuscation":"GiRK"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"q3gkMkxhdPY"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"1kD9XEs"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"N0ZPzkmAbAk"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_calls"},"finish_reason":null}],"usage":null,"obfuscation":"hI29CB"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"parallel"},"finish_reason":null}],"usage":null,"obfuscation":"PXIV"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/\n"},"finish_reason":null}],"usage":null,"obfuscation":"Pcod0FPRo"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"0PW38Aa"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"C5UbeTP4l4I"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_calls"},"finish_reason":null}],"usage":null,"obfuscation":"zUg4Ie"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" -"},"finish_reason":null}],"usage":null,"obfuscation":"NOu7fyq6dY"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"rQwTUtM"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" go"},"finish_reason":null}],"usage":null,"obfuscation":"7fyY9ug63"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"f1OEImnb0"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"IBzvNXO3"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"sMKPAjkCBq"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"NrBFIqJc6T"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"uohLmcAojx"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"2Djt662GOgr"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"c8JU78Sr"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" -"},"finish_reason":null}],"usage":null,"obfuscation":"bbnG6DTvES"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":","},"finish_reason":null}],"usage":null,"obfuscation":"4gpnKSqX6tk"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"gFMAbpi"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"JNlRRDP"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"t4BQcnngN"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"othFWP33q"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"39Vzf5"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"unUe4y"} - data: {"id":"chatcmpl-CToF9vmDCqMRm1InQZSrHmRm0jOSA","object":"chat.completion.chunk","created":1761220683,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6609,"completion_tokens":53,"total_tokens":6662,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Ubh9"} + data: {"id":"chatcmpl-CTtGdX4Op5vr3zfXgiT5ov0zqbpSE","object":"chat.completion.chunk","created":1761239995,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7540,"completion_tokens":30,"total_tokens":7570,"prompt_tokens_details":{"cached_tokens":7424,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"e1LQ"} data: [DONE] @@ -243,4 +195,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.429721541s + duration: 1.549352833s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml index 51a9c02d56bcc3752620cbe799275e80d9267153..66a587b3b337a93ff07bca14d6c369c3d73150ef 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml @@ -24,19 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsSU03iSgMmulBkJwLpFHe8XHpa","object":"chat.completion.chunk","created":1761219276,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OZGOOTOnArqkyY"} + data: {"id":"chatcmpl-CTtBqXaVBY4YzyeS0lvUjJAGovLBN","object":"chat.completion.chunk","created":1761239698,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ylfTmMzDoOgPd7"} - data: {"id":"chatcmpl-CTnsSU03iSgMmulBkJwLpFHe8XHpa","object":"chat.completion.chunk","created":1761219276,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Read"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"T5palGdgdukY"} + data: {"id":"chatcmpl-CTtBqXaVBY4YzyeS0lvUjJAGovLBN","object":"chat.completion.chunk","created":1761239698,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Understanding"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"lQ4"} - data: {"id":"chatcmpl-CTnsSU03iSgMmulBkJwLpFHe8XHpa","object":"chat.completion.chunk","created":1761219276,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" the"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"RpI9b6mPMRzc"} + data: {"id":"chatcmpl-CTtBqXaVBY4YzyeS0lvUjJAGovLBN","object":"chat.completion.chunk","created":1761239698,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"rbhOd6FZoytkv"} - data: {"id":"chatcmpl-CTnsSU03iSgMmulBkJwLpFHe8XHpa","object":"chat.completion.chunk","created":1761219276,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8BGtjXOZSm1nL"} + data: {"id":"chatcmpl-CTtBqXaVBY4YzyeS0lvUjJAGovLBN","object":"chat.completion.chunk","created":1761239698,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Mod"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Fs3SuMsOcvjb"} - data: {"id":"chatcmpl-CTnsSU03iSgMmulBkJwLpFHe8XHpa","object":"chat.completion.chunk","created":1761219276,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Mod"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"HHO6uHLIbBfb"} + data: {"id":"chatcmpl-CTtBqXaVBY4YzyeS0lvUjJAGovLBN","object":"chat.completion.chunk","created":1761239698,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"sAQnNVizjQ"} - data: {"id":"chatcmpl-CTnsSU03iSgMmulBkJwLpFHe8XHpa","object":"chat.completion.chunk","created":1761219276,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"3prpOfF449"} + data: {"id":"chatcmpl-CTtBqXaVBY4YzyeS0lvUjJAGovLBN","object":"chat.completion.chunk","created":1761239698,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"IvHc2x3bF1"} - data: {"id":"chatcmpl-CTnsSU03iSgMmulBkJwLpFHe8XHpa","object":"chat.completion.chunk","created":1761219276,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":129,"completion_tokens":4,"total_tokens":133,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"8CaRnllHN48CLN"} + data: {"id":"chatcmpl-CTtBqXaVBY4YzyeS0lvUjJAGovLBN","object":"chat.completion.chunk","created":1761239698,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":129,"completion_tokens":4,"total_tokens":133,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"gdQaLLbzBHiKsq"} data: [DONE] @@ -45,15 +45,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 509.348833ms + duration: 1.402804167s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29827 + content_length: 34283 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,65 +69,67 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_KxFioKxAz63IlSbNL9iWRYh5","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"iqfdQHIlF2ioXd"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_eoAosDAhihdUe3pg9ge5gvJm","type":"function","function":{"name":"glob","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"9qSiNxDTiOcf"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"OHK6Rjqg3IcSmif"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"GYWbD5YAHtWanf9"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vW9JrRjYfmG2k0"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m0dTrwPkvUj"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n6gDY8fH40nbytr"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"CvhOuWeU5xi0v"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fXiCv7Gm0m7DEa"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"**"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EbRpZWBA8IwfrDm"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DE1cmnx6r9Jht1B"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ddU8aA9eVFBWfXH"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".mod"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NkCQq2xHwkmHTv"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2zqPsUINWIFa2"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"NpTGxyqrzfe1n"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AXMHqlD6pa1do"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hvocJIliDLuHY3"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KbkSjF2kxTokF"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BjjrfPFdtcK6znp"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Jn9UgGBFHa9EJ"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"E8928bRivHatMj7"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MG1eL3OPJK6cP"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1dApapbVZDmif1U"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uyq2yeculUs5FH1"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"geYT273zQQfwLVh"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pE24ZQpqD7zNn"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"s"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"X8oSXFXtRnACQ"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XSd6YsoYhQWxi"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jkOLw7u4LJOzF"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xPuEG7BrlOjYC"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5bbpbMr1rmvjc"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1h8cyvHGLSDmg"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z0ZTxzTSu5AKO1y"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"i8fmVDJkwIu4DyO"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"u6wPlZtaLmuTi"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l85zVANMcd3fbzd"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0OUmpLO0iKuFh"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yXobND1LSJjEh"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PgelEZjVqNvbVuy"} - data: {"id":"chatcmpl-CTnsTlJdHtKSFwrXwjs8jSHdWJ1ji","object":"chat.completion.chunk","created":1761219277,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6466,"completion_tokens":557,"total_tokens":7023,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":512,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"P"} + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtBq9XPRnAw7lItuzfo3ZZQjw0nU","object":"chat.completion.chunk","created":1761239698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7399,"completion_tokens":557,"total_tokens":7956,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":512,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"w"} data: [DONE] @@ -136,15 +138,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 10.472917584s + duration: 22.935206125s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30208 + content_length: 34652 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_KxFioKxAz63IlSbNL9iWRYh5\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_KxFioKxAz63IlSbNL9iWRYh5\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_eoAosDAhihdUe3pg9ge5gvJm\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/go.mod\\\",\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/go.mod\",\"tool_call_id\":\"call_eoAosDAhihdUe3pg9ge5gvJm\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -160,69 +162,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_BEKV0KwPKJh5IvMLOJZrIGtZ","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"mMUidbQfhs0I"} - - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"TiEHeQSszEB6rcU"} - - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Avl38KHfKc3cQc"} - - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vyM9al6iK5MSe"} - - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZgWRINtxEARXyFB"} - - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GZ0ejyAN0kq8KCx"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_G0xRAOi7yzHGtKlMmdHIY13e","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"RebX67385oAq"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WGjWRZQOnvCpoBh"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"KTN51F5ECtF819H"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AISMw6fPkNNiFKS"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6LdbEYNlGcNHlv"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zK2oR7MzEl5GSCv"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Xzsd3ODDSum24"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0x3BJMyJIVFZa"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z4nasoqGhq44UPp"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YBM9bfXaJ9AFo"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ifFdSGg2etBEjva"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YAHeuIUU1C25I"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EMEm1GMAePH1dNX"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xgc4769psA6Ez"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d11Up6Ppuv4WyIM"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ADAW9qAO2mpIg"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VxWIwgDHpjFLfLe"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"svs77pKRtvvrG"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"psk7wx9xknphn"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ys4WSQTbNfvR5"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hYPMY2YPfSSlf"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"q"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ApSZDcADdVGvQ"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dfz7RsJrh5vSJ"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4PV2CveVnndE6"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0zrZHkv8DPe93ZS"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".mod"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0H4edvmgxhESEa"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"3oarIZq2zitDg"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cLo80TTAxOBxQ"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"limit"}}]},"finish_reason":null}],"usage":null,"obfuscation":"36E0fd53Y4ZXH"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MniTHGf6F68VYDw"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8WLhNrHZlM1DH"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"200"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7vtXvaRPK6LY3xk"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uNemugU3XNsw9Sx"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"a"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".mod"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H6OKPt0pFDHzRs"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pQUFLvU5yrvJRrl"} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnseJzEIuX6pjRMfTe1KglN72O6r","object":"chat.completion.chunk","created":1761219288,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6543,"completion_tokens":110,"total_tokens":6653,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"5Adiy"} + data: {"id":"chatcmpl-CTtCEbO4cCf6alUWNWDI9uLYpzyxM","object":"chat.completion.chunk","created":1761239722,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7466,"completion_tokens":35,"total_tokens":7501,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"jy1J"} data: [DONE] @@ -231,15 +223,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 5.66224525s + duration: 2.782605042s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30597 + content_length: 35026 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_KxFioKxAz63IlSbNL9iWRYh5\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_KxFioKxAz63IlSbNL9iWRYh5\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_BEKV0KwPKJh5IvMLOJZrIGtZ\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/go.mod\\\",\\\"limit\\\":2000}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_BEKV0KwPKJh5IvMLOJZrIGtZ\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_eoAosDAhihdUe3pg9ge5gvJm\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/go.mod\\\",\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/go.mod\",\"tool_call_id\":\"call_eoAosDAhihdUe3pg9ge5gvJm\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_G0xRAOi7yzHGtKlMmdHIY13e\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_G0xRAOi7yzHGtKlMmdHIY13e\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -255,33 +247,33 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"j4dbE0kTCk"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"NTMEUHZcxd"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"module"},"finish_reason":null}],"usage":null,"obfuscation":"6Q0LrV"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"module"},"finish_reason":null}],"usage":null,"obfuscation":"nbqEXr"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" example"},"finish_reason":null}],"usage":null,"obfuscation":"XyzL"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" example"},"finish_reason":null}],"usage":null,"obfuscation":"rtlL"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"Y6GK6xuY"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"x5ovBUmy"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/test"},"finish_reason":null}],"usage":null,"obfuscation":"N4jTfo1"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/test"},"finish_reason":null}],"usage":null,"obfuscation":"R09NrF1"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"project"},"finish_reason":null}],"usage":null,"obfuscation":"kTH4N"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"project"},"finish_reason":null}],"usage":null,"obfuscation":"NtnFm"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n\n"},"finish_reason":null}],"usage":null,"obfuscation":"Jqps5cPs"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"JjcvfUfeld"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"Yf1vSs2898"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"Ml38RCY3nF"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"QXt5BLFzSAp"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"rJDoQLyIga7"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"8OGx6Z4w8v1"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"VfzfPkyOT16"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"ZDeV3KAhdMY"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"foPvfPjnYJX"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"23"},"finish_reason":null}],"usage":null,"obfuscation":"RwHjNbyxQz"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"23"},"finish_reason":null}],"usage":null,"obfuscation":"YG6B3bwBnE"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"FVOxF5"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"yjoJit"} - data: {"id":"chatcmpl-CTnsjiK956U3yJcNNGnNY9TV135ba","object":"chat.completion.chunk","created":1761219293,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6623,"completion_tokens":14,"total_tokens":6637,"prompt_tokens_details":{"cached_tokens":6528,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"NjZJ"} + data: {"id":"chatcmpl-CTtCGOr5Ny0PNPOkHQnsTccKhrK1c","object":"chat.completion.chunk","created":1761239724,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7541,"completion_tokens":14,"total_tokens":7555,"prompt_tokens_details":{"cached_tokens":7424,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"lYIg"} data: [DONE] @@ -290,4 +282,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.844991375s + duration: 1.780101833s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml index d66fc9a8cc2284c7c3b2f787241a1bb78ecaaa73..c6a27cb47faa37ec6a2b64a5119c58c4148452fd 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml @@ -24,17 +24,17 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsPHq388hN9VuFmjDpHiUPlxa84","object":"chat.completion.chunk","created":1761219273,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"97Cy9xN03PqdzK"} + data: {"id":"chatcmpl-CTtBmgn5mYpocQkE6j46WRztzCMuk","object":"chat.completion.chunk","created":1761239694,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"HIOszqvOqqv7kS"} - data: {"id":"chatcmpl-CTnsPHq388hN9VuFmjDpHiUPlxa84","object":"chat.completion.chunk","created":1761219273,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Greetings"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"CpDjM66"} + data: {"id":"chatcmpl-CTtBmgn5mYpocQkE6j46WRztzCMuk","object":"chat.completion.chunk","created":1761239694,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Greetings"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"xZTLjee"} - data: {"id":"chatcmpl-CTnsPHq388hN9VuFmjDpHiUPlxa84","object":"chat.completion.chunk","created":1761219273,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"UxTRIMjPP4Qt"} + data: {"id":"chatcmpl-CTtBmgn5mYpocQkE6j46WRztzCMuk","object":"chat.completion.chunk","created":1761239694,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bCV7T7xiIZ6I"} - data: {"id":"chatcmpl-CTnsPHq388hN9VuFmjDpHiUPlxa84","object":"chat.completion.chunk","created":1761219273,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Introduction"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"kEr"} + data: {"id":"chatcmpl-CTtBmgn5mYpocQkE6j46WRztzCMuk","object":"chat.completion.chunk","created":1761239694,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Introduction"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Fca"} - data: {"id":"chatcmpl-CTnsPHq388hN9VuFmjDpHiUPlxa84","object":"chat.completion.chunk","created":1761219273,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"VzGq8TKPi7"} + data: {"id":"chatcmpl-CTtBmgn5mYpocQkE6j46WRztzCMuk","object":"chat.completion.chunk","created":1761239694,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"tN3u8jrIjV"} - data: {"id":"chatcmpl-CTnsPHq388hN9VuFmjDpHiUPlxa84","object":"chat.completion.chunk","created":1761219273,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":126,"completion_tokens":3,"total_tokens":129,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"I36B3yNq4eVBsW"} + data: {"id":"chatcmpl-CTtBmgn5mYpocQkE6j46WRztzCMuk","object":"chat.completion.chunk","created":1761239694,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":126,"completion_tokens":3,"total_tokens":129,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"142WrYHN7llNCD"} data: [DONE] @@ -43,15 +43,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.084419333s + duration: 664.58725ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29817 + content_length: 34273 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -67,13 +67,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsQ2kXJ4tEMo8SjWlQJH0NZ4hHV","object":"chat.completion.chunk","created":1761219274,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"6wPJk1PqzC"} + data: {"id":"chatcmpl-CTtBnw4oZpL5ssiMs7QKA9EyT1faV","object":"chat.completion.chunk","created":1761239695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"LjSrzH5BV2"} - data: {"id":"chatcmpl-CTnsQ2kXJ4tEMo8SjWlQJH0NZ4hHV","object":"chat.completion.chunk","created":1761219274,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Hi"},"finish_reason":null}],"usage":null,"obfuscation":"LsVhgfCRbM"} + data: {"id":"chatcmpl-CTtBnw4oZpL5ssiMs7QKA9EyT1faV","object":"chat.completion.chunk","created":1761239695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Hi"},"finish_reason":null}],"usage":null,"obfuscation":"cnKhxJ2rz6"} - data: {"id":"chatcmpl-CTnsQ2kXJ4tEMo8SjWlQJH0NZ4hHV","object":"chat.completion.chunk","created":1761219274,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"kPve2p"} + data: {"id":"chatcmpl-CTtBnw4oZpL5ssiMs7QKA9EyT1faV","object":"chat.completion.chunk","created":1761239695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"LFBkJG"} - data: {"id":"chatcmpl-CTnsQ2kXJ4tEMo8SjWlQJH0NZ4hHV","object":"chat.completion.chunk","created":1761219274,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6462,"completion_tokens":74,"total_tokens":6536,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"ZPj"} + data: {"id":"chatcmpl-CTtBnw4oZpL5ssiMs7QKA9EyT1faV","object":"chat.completion.chunk","created":1761239695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7395,"completion_tokens":10,"total_tokens":7405,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"5OMq"} data: [DONE] @@ -82,4 +82,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.64046325s + duration: 3.404411958s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml index 16254a9718677a857aa1820fcaccecb7f4d6db8a..324dc1d32cf0f2d3646ec8f838ee89619743d976 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml @@ -24,35 +24,35 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"rDSzI9962EPhz9"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"71wXAFH1QasYXU"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Searching"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8tdQ1t0"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Searching"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"KfyYPpJ"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"hj0taOjFubCa3H"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"4s9xOdtTSkRq62"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"func"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"keBYzaBOssVk"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"func"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BSMOjNqHKHcP"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"cttyPqxVuh4"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"uVBy5exmJ59"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"JBnCCjbV0Q30iPH"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"m5n9bhmfUyMxsHW"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OCqKWjsaqS47X"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"IR8Vj6LCHnWBA"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"CBQwU4UQhQ1r9"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"y3EcqGQPUOJhq"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Re"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ItEEr5WdGnwwk"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Re"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LdGlE1yyecfvE"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"positories"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"3KpHpo"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"positories"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"IO2RCf"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"daSs4KZZEk0"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"wSmtNIZMiAj"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Source"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ePojNKSFv"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" Source"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Q7attQ9kQ"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"graph"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QQXCeVjuufP"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"graph"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MtSHkGPL9oh"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"cnCxwT4ebg"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"5MEWEU2ggV"} - data: {"id":"chatcmpl-CTnvX6OF7gHcRK2h6A9EJhAVsmIkF","object":"chat.completion.chunk","created":1761219467,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":12,"total_tokens":150,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"cCkh0KGoATByQ"} + data: {"id":"chatcmpl-CTtFbHndeQPdPZN9bea8mNhhYZaHP","object":"chat.completion.chunk","created":1761239931,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":12,"total_tokens":150,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"qFus8lWXchhIO"} data: [DONE] @@ -61,15 +61,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 501.56625ms + duration: 493.20425ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29877 + content_length: 34333 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -85,61 +85,51 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_eG1GRwBeCLOUWghVcDdwhumF","type":"function","function":{"name":"sourcegraph","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"KNwnd"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_V0HcojYtDXno6EPtEMUvUMWX","type":"function","function":{"name":"sourcegraph","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"0AOYu"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"B4F34BsTzo9ImPq"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"f1o9dparhEfUe6v"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"query"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FV2Suqb4wCJ5C"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"query"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Vo7ZmrVrvYhf8"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"BDqk9igcRqCLa"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"50whMPcW6fLzL"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"lang"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P717JzJq2LNTGf"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"lang"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eI0hOE7506o7f8"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wIw4eebMDZ"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ms6XLbuNzJ5Cc"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"TpBdz0RijeNlT"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nV6e6nmaB09pQk"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"29EFXQdjTDGKvA"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9x7D5VDTPLPGK"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T8yBXZv7fHNb0"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"o6UvzrfHybTql"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"FgLNODazvhmtM"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" select"}}]},"finish_reason":null}],"usage":null,"obfuscation":"u5LSbuF5CFo"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" type"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h8xgJhaM1LlF8"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tTWOfoZjxFIiz"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QA3jh0efyPZpz"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YK60U2IdRS1y"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aYeMDjHeYfTY"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"IGCZKHlXhGkOA"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"IGodqFItJQ40l"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3sAQq34Rp9fJL"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Og2lcFbwqnX3i"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NXSUocNq4svAUtJ"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"noTpYKhwwWqhc2c"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n"} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"h53MYNr1CbGqYil"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"a9HbkwMF16b"} - - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"V5voHkwgyW8MVOa"} - - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"60"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7"} - - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CTnvXZsU9yAibW6raxyo30ActhbA0","object":"chat.completion.chunk","created":1761219467,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6475,"completion_tokens":299,"total_tokens":6774,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"GBDU"} + data: {"id":"chatcmpl-CTtFbNWhpDg8fxYFNNVvsjxGWJGlr","object":"chat.completion.chunk","created":1761239931,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7408,"completion_tokens":294,"total_tokens":7702,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"a"} data: [DONE] @@ -148,15 +138,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 9.563071792s + duration: 12.422938917s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 456 + content_length: 450 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 content:\"func main(\" type:file count:10"}}' + body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"lang:go \"func main(\" select:file count:10"}}' headers: Content-Type: - application/json @@ -170,21 +160,21 @@ interactions: proto_minor: 0 content_length: -1 uncompressed: true - body: '{"data":{"search":{"results":{"matchCount":10,"limitHit":true,"resultCount":10,"approximateResultCount":"10+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/yinchengtsinghua/go-ethereum-chinese"},"file":{"path":"cmd/wnode/main.go","url":"/github.com/yinchengtsinghua/go-ethereum-chinese/-/blob/cmd/wnode/main.go","content":"\n//此源码被清华学神尹成大魔王专业翻译分析并修改\n//尹成QQ77025077\n//尹成微信18510341407\n//尹成所在QQ群721929980\n//尹成邮箱 yinc13@mails.tsinghua.edu.cn\n//尹成毕业于清华大学,微软区块链领域全球最有价值专家\n//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620\n//版权所有2017 Go Ethereum作者\n//此文件是Go以太坊的一部分。\n//\n//Go以太坊是免费软件:您可以重新发布和/或修改它\n//根据GNU通用公共许可证的条款\n//自由软件基金会,或者许可证的第3版,或者\n//(由您选择)任何更高版本。\n//\n//Go以太坊的分布希望它会有用,\n//但没有任何保证;甚至没有\n//适销性或特定用途的适用性。见\n//GNU通用公共许可证了解更多详细信息。\n//\n//你应该已经收到一份GNU通用公共许可证的副本\n//一起去以太坊吧。如果没有,请参见\u003chttp://www.gnu.org/licenses/\u003e。\n\n//这是一个简单的耳语节点。它可以用作独立的引导节点。\n//也可用于不同的测试和诊断目的。\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"crypto/ecdsa\"\n\tcrand \"crypto/rand\"\n\t\"crypto/sha512\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"flag\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/ethereum/go-ethereum/cmd/utils\"\n\t\"github.com/ethereum/go-ethereum/common\"\n\t\"github.com/ethereum/go-ethereum/console\"\n\t\"github.com/ethereum/go-ethereum/crypto\"\n\t\"github.com/ethereum/go-ethereum/log\"\n\t\"github.com/ethereum/go-ethereum/p2p\"\n\t\"github.com/ethereum/go-ethereum/p2p/enode\"\n\t\"github.com/ethereum/go-ethereum/p2p/nat\"\n\t\"github.com/ethereum/go-ethereum/whisper/mailserver\"\n\twhisper \"github.com/ethereum/go-ethereum/whisper/whisperv6\"\n\t\"golang.org/x/crypto/pbkdf2\"\n)\n\nconst quitCommand = \"~Q\"\nconst entropySize = 32\n\n//独生子女\nvar (\n\tserver *p2p.Server\n\tshh *whisper.Whisper\n\tdone chan struct{}\n\tmailServer mailserver.WMailServer\n\tentropy [entropySize]byte\n\n\tinput = bufio.NewReader(os.Stdin)\n)\n\n//加密\nvar (\n\tsymKey []byte\n\tpub *ecdsa.PublicKey\n\tasymKey *ecdsa.PrivateKey\n\tnodeid *ecdsa.PrivateKey\n\ttopic whisper.TopicType\n\n\tasymKeyID string\n\tasymFilterID string\n\tsymFilterID string\n\tsymPass string\n\tmsPassword string\n)\n\n//CMD参数\nvar (\n\tbootstrapMode = flag.Bool(\"standalone\", false, \"boostrap node: don''t initiate connection to peers, just wait for incoming connections\")\n\tforwarderMode = flag.Bool(\"forwarder\", false, \"forwarder mode: only forward messages, neither encrypt nor decrypt messages\")\n\tmailServerMode = flag.Bool(\"mailserver\", false, \"mail server mode: delivers expired messages on demand\")\n\trequestMail = flag.Bool(\"mailclient\", false, \"request expired messages from the bootstrap server\")\n\tasymmetricMode = flag.Bool(\"asym\", false, \"use asymmetric encryption\")\n\tgenerateKey = flag.Bool(\"generatekey\", false, \"generate and show the private key\")\n\tfileExMode = flag.Bool(\"fileexchange\", false, \"file exchange mode\")\n\tfileReader = flag.Bool(\"filereader\", false, \"load and decrypt messages saved as files, display as plain text\")\n\ttestMode = flag.Bool(\"test\", false, \"use of predefined parameters for diagnostics (password, etc.)\")\n\techoMode = flag.Bool(\"echo\", false, \"echo mode: prints some arguments for diagnostics\")\n\n\targVerbosity = flag.Int(\"verbosity\", int(log.LvlError), \"log verbosity level\")\n\targTTL = flag.Uint(\"ttl\", 30, \"time-to-live for messages in seconds\")\n\targWorkTime = flag.Uint(\"work\", 5, \"work time in seconds\")\n\targMaxSize = flag.Uint(\"maxsize\", uint(whisper.DefaultMaxMessageSize), \"max size of message\")\n\targPoW = flag.Float64(\"pow\", whisper.DefaultMinimumPoW, \"PoW for normal messages in float format (e.g. 2.7)\")\n\targServerPoW = flag.Float64(\"mspow\", whisper.DefaultMinimumPoW, \"PoW requirement for Mail Server request\")\n\n\targIP = flag.String(\"ip\", \"\", \"IP address and port of this node (e.g. 127.0.0.1:30303)\")\n\targPub = flag.String(\"pub\", \"\", \"public key for asymmetric encryption\")\n\targDBPath = flag.String(\"dbpath\", \"\", \"path to the server''s DB directory\")\n\targIDFile = flag.String(\"idfile\", \"\", \"file name with node id (private key)\")\nargEnode = flag.String(\"boot\", \"\", \"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\n\targTopic = flag.String(\"topic\", \"\", \"topic in hexadecimal format (e.g. 70a4beef)\")\n\targSaveDir = flag.String(\"savedir\", \"\", \"directory where all incoming messages will be saved as files\")\n)\n\nfunc main() {\n\tprocessArgs()\n\tinitialize()\n\trun()\n\tshutdown()\n}\n\nfunc processArgs() {\n\tflag.Parse()\n\n\tif len(*argIDFile) \u003e 0 {\n\t\tvar err error\n\t\tnodeid, err = crypto.LoadECDSA(*argIDFile)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to load file [%s]: %s.\", *argIDFile, err)\n\t\t}\n\t}\n\nconst enodePrefix = \"enode://“\n\tif len(*argEnode) \u003e 0 {\n\t\tif (*argEnode)[:len(enodePrefix)] != enodePrefix {\n\t\t\t*argEnode = enodePrefix + *argEnode\n\t\t}\n\t}\n\n\tif len(*argTopic) \u003e 0 {\n\t\tx, err := hex.DecodeString(*argTopic)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to parse the topic: %s\", err)\n\t\t}\n\t\ttopic = whisper.BytesToTopic(x)\n\t}\n\n\tif *asymmetricMode \u0026\u0026 len(*argPub) \u003e 0 {\n\t\tvar err error\n\t\tif pub, err = crypto.UnmarshalPubkey(common.FromHex(*argPub)); err != nil {\n\t\t\tutils.Fatalf(\"invalid public key\")\n\t\t}\n\t}\n\n\tif len(*argSaveDir) \u003e 0 {\n\t\tif _, err := os.Stat(*argSaveDir); os.IsNotExist(err) {\n\t\t\tutils.Fatalf(\"Download directory ''%s'' does not exist\", *argSaveDir)\n\t\t}\n\t} else if *fileExMode {\n\t\tutils.Fatalf(\"Parameter ''savedir'' is mandatory for file exchange mode\")\n\t}\n\n\tif *echoMode {\n\t\techo()\n\t}\n}\n\nfunc echo() {\n\tfmt.Printf(\"ttl = %d \\n\", *argTTL)\n\tfmt.Printf(\"workTime = %d \\n\", *argWorkTime)\n\tfmt.Printf(\"pow = %f \\n\", *argPoW)\n\tfmt.Printf(\"mspow = %f \\n\", *argServerPoW)\n\tfmt.Printf(\"ip = %s \\n\", *argIP)\n\tfmt.Printf(\"pub = %s \\n\", common.ToHex(crypto.FromECDSAPub(pub)))\n\tfmt.Printf(\"idfile = %s \\n\", *argIDFile)\n\tfmt.Printf(\"dbpath = %s \\n\", *argDBPath)\n\tfmt.Printf(\"boot = %s \\n\", *argEnode)\n}\n\nfunc initialize() {\n\tlog.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*argVerbosity), log.StreamHandler(os.Stderr, log.TerminalFormat(false))))\n\n\tdone = make(chan struct{})\n\tvar peers []*enode.Node\n\tvar err error\n\n\tif *generateKey {\n\t\tkey, err := crypto.GenerateKey()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate private key: %s\", err)\n\t\t}\n\t\tk := hex.EncodeToString(crypto.FromECDSA(key))\n\t\tfmt.Printf(\"Random private key: %s \\n\", k)\n\t\tos.Exit(0)\n\t}\n\n\tif *testMode {\nsymPass = \"wwww\" //ASCII码:0x77777777\n\t\tmsPassword = \"wwww\"\n\t}\n\n\tif *bootstrapMode {\n\t\tif len(*argIP) == 0 {\n\t\t\targIP = scanLineA(\"Please enter your IP and port (e.g. 127.0.0.1:30348): \")\n\t\t}\n\t} else if *fileReader {\n\t\t*bootstrapMode = true\n\t} else {\n\t\tif len(*argEnode) == 0 {\n\t\t\targEnode = scanLineA(\"Please enter the peer''s enode: \")\n\t\t}\n\t\tpeer := enode.MustParseV4(*argEnode)\n\t\tpeers = append(peers, peer)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tcfg := \u0026whisper.Config{\n\t\tMaxMessageSize: uint32(*argMaxSize),\n\t\tMinimumAcceptedPOW: *argPoW,\n\t}\n\n\tshh = whisper.New(cfg)\n\n\tif *argPoW != whisper.DefaultMinimumPoW {\n\t\terr := shh.SetMinimumPoW(*argPoW)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set PoW: %s\", err)\n\t\t}\n\t}\n\n\tif uint32(*argMaxSize) != whisper.DefaultMaxMessageSize {\n\t\terr := shh.SetMaxMessageSize(uint32(*argMaxSize))\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set max message size: %s\", err)\n\t\t}\n\t}\n\n\tasymKeyID, err = shh.NewKeyPair()\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t}\n\n\tasymKey, err = shh.GetPrivateKey(asymKeyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t}\n\n\tif nodeid == nil {\n\t\ttmpID, err := shh.NewKeyPair()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t\t}\n\n\t\tnodeid, err = shh.GetPrivateKey(tmpID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t\t}\n\t}\n\n\tmaxPeers := 80\n\tif *bootstrapMode {\n\t\tmaxPeers = 800\n\t}\n\n\t_, err = crand.Read(entropy[:])\n\tif err != nil {\n\t\tutils.Fatalf(\"crypto/rand failed: %s\", err)\n\t}\n\n\tif *mailServerMode {\n\t\tshh.RegisterServer(\u0026mailServer)\n\t\tif err := mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW); err != nil {\n\t\t\tutils.Fatalf(\"Failed to init MailServer: %s\", err)\n\t\t}\n\t}\n\n\tserver = \u0026p2p.Server{\n\t\tConfig: p2p.Config{\n\t\t\tPrivateKey: nodeid,\n\t\t\tMaxPeers: maxPeers,\n\t\t\tName: common.MakeName(\"wnode\", \"6.0\"),\n\t\t\tProtocols: shh.Protocols(),\n\t\t\tListenAddr: *argIP,\n\t\t\tNAT: nat.Any(),\n\t\t\tBootstrapNodes: peers,\n\t\t\tStaticNodes: peers,\n\t\t\tTrustedNodes: peers,\n\t\t},\n\t}\n}\n\nfunc startServer() error {\n\terr := server.Start()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to start Whisper peer: %s.\", err)\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"my public key: %s \\n\", common.ToHex(crypto.FromECDSAPub(\u0026asymKey.PublicKey)))\n\tfmt.Println(server.NodeInfo().Enode)\n\n\tif *bootstrapMode {\n\t\tconfigureNode()\n\t\tfmt.Println(\"Bootstrap Whisper node started\")\n\t} else {\n\t\tfmt.Println(\"Whisper node started\")\n//首先看看我们是否可以建立连接,然后请求用户输入\n\t\twaitForConnection(true)\n\t\tconfigureNode()\n\t}\n\n\tif *fileExMode {\n\t\tfmt.Printf(\"Please type the file name to be send. To quit type: ''%s''\\n\", quitCommand)\n\t} else if *fileReader {\n\t\tfmt.Printf(\"Please type the file name to be decrypted. To quit type: ''%s''\\n\", quitCommand)\n\t} else if !*forwarderMode {\n\t\tfmt.Printf(\"Please type the message. To quit type: ''%s''\\n\", quitCommand)\n\t}\n\treturn nil\n}\n\nfunc configureNode() {\n\tvar err error\n\tvar p2pAccept bool\n\n\tif *forwarderMode {\n\t\treturn\n\t}\n\n\tif *asymmetricMode {\n\t\tif len(*argPub) == 0 {\n\t\t\ts := scanLine(\"Please enter the peer''s public key: \")\n\t\t\tb := common.FromHex(s)\n\t\t\tif b == nil {\n\t\t\t\tutils.Fatalf(\"Error: can not convert hexadecimal string\")\n\t\t\t}\n\t\t\tif pub, err = crypto.UnmarshalPubkey(b); err != nil {\n\t\t\t\tutils.Fatalf(\"Error: invalid peer public key\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif *requestMail {\n\t\tp2pAccept = true\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !*asymmetricMode \u0026\u0026 !*forwarderMode {\n\t\tif len(symPass) == 0 {\n\t\t\tsymPass, err = console.Stdin.PromptPassword(\"Please enter the password for symmetric encryption: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read passphrase: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tsymKeyID, err := shh.AddSymKeyFromPassword(symPass)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to create symmetric key: %s\", err)\n\t\t}\n\t\tsymKey, err = shh.GetSymKey(symKeyID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to save symmetric key: %s\", err)\n\t\t}\n\t\tif len(*argTopic) == 0 {\n\t\t\tgenerateTopic([]byte(symPass))\n\t\t}\n\n\t\tfmt.Printf(\"Filter is configured for the topic: %x \\n\", topic)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(*argDBPath) == 0 {\n\t\t\targDBPath = scanLineA(\"Please enter the path to DB file: \")\n\t\t}\n\t}\n\n\tsymFilter := whisper.Filter{\n\t\tKeySym: symKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tsymFilterID, err = shh.Subscribe(\u0026symFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n\n\tasymFilter := whisper.Filter{\n\t\tKeyAsym: asymKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tasymFilterID, err = shh.Subscribe(\u0026asymFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n}\n\nfunc generateTopic(password []byte) {\n\tx := pbkdf2.Key(password, password, 4096, 128, sha512.New)\n\tfor i := 0; i \u003c len(x); i++ {\n\t\ttopic[i%whisper.TopicLength] ^= x[i]\n\t}\n}\n\nfunc waitForConnection(timeout bool) {\n\tvar cnt int\n\tvar connected bool\n\tfor !connected {\n\t\ttime.Sleep(time.Millisecond * 50)\n\t\tconnected = server.PeerCount() \u003e 0\n\t\tif timeout {\n\t\t\tcnt++\n\t\t\tif cnt \u003e 1000 {\n\t\t\t\tutils.Fatalf(\"Timeout expired, failed to connect\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"Connected to peer.\")\n}\n\nfunc run() {\n\terr := startServer()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer server.Stop()\n\tshh.Start(nil)\n\tdefer shh.Stop()\n\n\tif !*forwarderMode {\n\t\tgo messageLoop()\n\t}\n\n\tif *requestMail {\n\t\trequestExpiredMessagesLoop()\n\t} else if *fileExMode {\n\t\tsendFilesLoop()\n\t} else if *fileReader {\n\t\tfileReaderLoop()\n\t} else {\n\t\tsendLoop()\n\t}\n}\n\nfunc shutdown() {\n\tclose(done)\n\tmailServer.Close()\n}\n\nfunc sendLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tsendMsg([]byte(s))\n\t\tif *asymmetricMode {\n//为方便起见,请打印您自己的消息,\n//因为在非对称模式下是不可能解密的\n\t\t\ttimestamp := time.Now().Unix()\n\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: %s\\n\", timestamp, from, s)\n\t\t}\n\t}\n}\n\nfunc sendFilesLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tb, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\n\t\t\th := sendMsg(b)\n\t\t\tif (h == common.Hash{}) {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: message was not sent \\n\")\n\t\t\t} else {\n\t\t\t\ttimestamp := time.Now().Unix()\n\t\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: sent message with hash %x\\n\", timestamp, from, h)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc fileReaderLoop() {\n\twatcher1 := shh.GetFilter(symFilterID)\n\twatcher2 := shh.GetFilter(asymFilterID)\n\tif watcher1 == nil \u0026\u0026 watcher2 == nil {\n\t\tfmt.Println(\"Error: neither symmetric nor asymmetric filter is installed\")\n\t\treturn\n\t}\n\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\traw, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\nenv := whisper.Envelope{Data: raw} //主题为零\nmsg := env.Open(watcher1) //不管主题如何,都强制打开信封\n\t\t\tif msg == nil {\n\t\t\t\tmsg = env.Open(watcher2)\n\t\t\t}\n\t\t\tif msg == nil {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: failed to decrypt the message \\n\")\n\t\t\t} else {\n\t\t\t\tprintMessageInfo(msg)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc scanLine(prompt string) string {\n\tif len(prompt) \u003e 0 {\n\t\tfmt.Print(prompt)\n\t}\n\ttxt, err := input.ReadString(''\\n'')\n\tif err != nil {\n\t\tutils.Fatalf(\"input error: %s\", err)\n\t}\n\ttxt = strings.TrimRight(txt, \"\\n\\r\")\n\treturn txt\n}\n\nfunc scanLineA(prompt string) *string {\n\ts := scanLine(prompt)\n\treturn \u0026s\n}\n\nfunc scanUint(prompt string) uint32 {\n\ts := scanLine(prompt)\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Fail to parse the lower time limit: %s\", err)\n\t}\n\treturn uint32(i)\n}\n\nfunc sendMsg(payload []byte) common.Hash {\n\tparams := whisper.MessageParams{\n\t\tSrc: asymKey,\n\t\tDst: pub,\n\t\tKeySym: symKey,\n\t\tPayload: payload,\n\t\tTopic: topic,\n\t\tTTL: uint32(*argTTL),\n\t\tPoW: *argPoW,\n\t\tWorkTime: uint32(*argWorkTime),\n\t}\n\n\tmsg, err := whisper.NewSentMessage(\u0026params)\n\tif err != nil {\n\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t}\n\n\tenvelope, err := msg.Wrap(\u0026params)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to seal message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\terr = shh.Send(envelope)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to send message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\treturn envelope.Hash()\n}\n\nfunc messageLoop() {\n\tsf := shh.GetFilter(symFilterID)\n\tif sf == nil {\n\t\tutils.Fatalf(\"symmetric filter is not installed\")\n\t}\n\n\taf := shh.GetFilter(asymFilterID)\n\tif af == nil {\n\t\tutils.Fatalf(\"asymmetric filter is not installed\")\n\t}\n\n\tticker := time.NewTicker(time.Millisecond * 50)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-ticker.C:\n\t\t\tm1 := sf.Retrieve()\n\t\t\tm2 := af.Retrieve()\n\t\t\tmessages := append(m1, m2...)\n\t\t\tfor _, msg := range messages {\n\t\t\t\treportedOnce := false\n\t\t\t\tif !*fileExMode \u0026\u0026 len(msg.Payload) \u003c= 2048 {\n\t\t\t\t\tprintMessageInfo(msg)\n\t\t\t\t\treportedOnce = true\n\t\t\t\t}\n\n//在指定argsavedir时保存所有消息。\n//FileExMode仅指定消息保存后如何显示在控制台上。\n//如果fileexmode==true,则只显示哈希值,因为消息可能太大。\n\t\t\t\tif len(*argSaveDir) \u003e 0 {\n\t\t\t\t\twriteMessageToFile(*argSaveDir, msg, !reportedOnce)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc printMessageInfo(msg *whisper.ReceivedMessage) {\ntimestamp := fmt.Sprintf(\"%d\", msg.Sent) //用于诊断的Unix时间戳\n\ttext := string(msg.Payload)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tif whisper.IsPubKeyEqual(msg.Src, \u0026asymKey.PublicKey) {\nfmt.Printf(\"\\n%s \u003c%x\u003e: %s\\n\", timestamp, address, text) //我的信息\n\t} else {\nfmt.Printf(\"\\n%s [%x]: %s\\n\", timestamp, address, text) //来自对等方的消息\n\t}\n}\n\nfunc writeMessageToFile(dir string, msg *whisper.ReceivedMessage, show bool) {\n\tif len(dir) == 0 {\n\t\treturn\n\t}\n\n\ttimestamp := fmt.Sprintf(\"%d\", msg.Sent)\n\tname := fmt.Sprintf(\"%x\", msg.EnvelopeHash)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tenv := shh.GetEnvelope(msg.EnvelopeHash)\n\tif env == nil {\n\t\tfmt.Printf(\"\\nUnexpected error: envelope not found: %x\\n\", msg.EnvelopeHash)\n\t\treturn\n\t}\n\n//这是一个示例代码;如果不想保存自己的消息,请取消注释。\n//如果whisper.ispubkeyequal(msg.src,\u0026asymkey.publickey)\n//fmt.printf(“\\n%s\u003c%x\u003e:我收到的消息,未保存:“%s''\\n”,时间戳,地址,名称)\n//返回\n//}\n\n\tfullpath := filepath.Join(dir, name)\n\terr := ioutil.WriteFile(fullpath, env.Data, 0644)\n\tif err != nil {\n\t\tfmt.Printf(\"\\n%s {%x}: message received but not saved: %s\\n\", timestamp, address, err)\n\t} else if show {\n\t\tfmt.Printf(\"\\n%s {%x}: message received and saved as ''%s'' (%d bytes)\\n\", timestamp, address, name, len(env.Data))\n\t}\n}\n\nfunc requestExpiredMessagesLoop() {\n\tvar key, peerID, bloom []byte\n\tvar timeLow, timeUpp uint32\n\tvar t string\n\tvar xt whisper.TopicType\n\n\tkeyID, err := shh.AddSymKeyFromPassword(msPassword)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to create symmetric key for mail request: %s\", err)\n\t}\n\tkey, err = shh.GetSymKey(keyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to save symmetric key for mail request: %s\", err)\n\t}\n\tpeerID = extractIDFromEnode(*argEnode)\n\tshh.AllowP2PMessagesFromPeer(peerID)\n\n\tfor {\n\t\ttimeLow = scanUint(\"Please enter the lower limit of the time range (unix timestamp): \")\n\t\ttimeUpp = scanUint(\"Please enter the upper limit of the time range (unix timestamp): \")\n\t\tt = scanLine(\"Enter the topic (hex). Press enter to request all messages, regardless of the topic: \")\n\t\tif len(t) == whisper.TopicLength*2 {\n\t\t\tx, err := hex.DecodeString(t)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to parse the topic: %s \\n\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txt = whisper.BytesToTopic(x)\n\t\t\tbloom = whisper.TopicToBloom(xt)\n\t\t\tobfuscateBloom(bloom)\n\t\t} else if len(t) == 0 {\n\t\t\tbloom = whisper.MakeFullNodeBloom()\n\t\t} else {\n\t\t\tfmt.Println(\"Error: topic is invalid, request aborted\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif timeUpp == 0 {\n\t\t\ttimeUpp = 0xFFFFFFFF\n\t\t}\n\n\t\tdata := make([]byte, 8, 8+whisper.BloomFilterSize)\n\t\tbinary.BigEndian.PutUint32(data, timeLow)\n\t\tbinary.BigEndian.PutUint32(data[4:], timeUpp)\n\t\tdata = append(data, bloom...)\n\n\t\tvar params whisper.MessageParams\n\t\tparams.PoW = *argServerPoW\n\t\tparams.Payload = data\n\t\tparams.KeySym = key\n\t\tparams.Src = asymKey\n\t\tparams.WorkTime = 5\n\n\t\tmsg, err := whisper.NewSentMessage(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t\t}\n\t\tenv, err := msg.Wrap(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Wrap failed: %s\", err)\n\t\t}\n\n\t\terr = shh.RequestHistoricMessages(peerID, env)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to send P2P message: %s\", err)\n\t\t}\n\n\t\ttime.Sleep(time.Second * 5)\n\t}\n}\n\nfunc extractIDFromEnode(s string) []byte {\n\tn, err := enode.ParseV4(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to parse enode: %s\", err)\n\t}\n\treturn n.ID().Bytes()\n}\n\n//模糊布卢姆增加16个随机位到布卢姆\n//筛选,以便混淆包含的主题。\n//它在每个会话中都具有确定性。\n//尽管有额外的位,它将平均匹配\n//比完整节点的Bloom过滤器少32000倍的消息。\nfunc obfuscateBloom(bloom []byte) {\n\tconst half = entropySize / 2\n\tfor i := 0; i \u003c half; i++ {\n\t\tx := int(entropy[i])\n\t\tif entropy[half+i] \u003c 128 {\n\t\t\tx += 256\n\t\t}\n\nbloom[x/8] = 1 \u003c\u003c uint(x%8) //设置位号x\n\t}\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":116,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum"},"file":{"path":"cmd/wnode/main.go","url":"/github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/-/blob/cmd/wnode/main.go","content":"\n//此源码被清华学神尹成大魔王专业翻译分析并修改\n//尹成QQ77025077\n//尹成微信18510341407\n//尹成所在QQ群721929980\n//尹成邮箱 yinc13@mails.tsinghua.edu.cn\n//尹成毕业于清华大学,微软区块链领域全球最有价值专家\n//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620\n//版权所有2017 Go Ethereum作者\n//此文件是Go以太坊的一部分。\n//\n//Go以太坊是免费软件:您可以重新发布和/或修改它\n//根据GNU通用公共许可证的条款\n//自由软件基金会,或者许可证的第3版,或者\n//(由您选择)任何更高版本。\n//\n//Go以太坊的分布希望它会有用,\n//但没有任何保证;甚至没有\n//适销性或特定用途的适用性。见\n//GNU通用公共许可证了解更多详细信息。\n//\n//你应该已经收到一份GNU通用公共许可证的副本\n//一起去以太坊吧。如果没有,请参见\u003chttp://www.gnu.org/licenses/\u003e。\n\n//这是一个简单的耳语节点。它可以用作独立的引导节点。\n//也可用于不同的测试和诊断目的。\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"crypto/ecdsa\"\n\tcrand \"crypto/rand\"\n\t\"crypto/sha512\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"flag\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/ethereum/go-ethereum/cmd/utils\"\n\t\"github.com/ethereum/go-ethereum/common\"\n\t\"github.com/ethereum/go-ethereum/console\"\n\t\"github.com/ethereum/go-ethereum/crypto\"\n\t\"github.com/ethereum/go-ethereum/log\"\n\t\"github.com/ethereum/go-ethereum/p2p\"\n\t\"github.com/ethereum/go-ethereum/p2p/discover\"\n\t\"github.com/ethereum/go-ethereum/p2p/nat\"\n\t\"github.com/ethereum/go-ethereum/whisper/mailserver\"\n\twhisper \"github.com/ethereum/go-ethereum/whisper/whisperv6\"\n\t\"golang.org/x/crypto/pbkdf2\"\n)\n\nconst quitCommand = \"~Q\"\nconst entropySize = 32\n\n//独生子女\nvar (\n\tserver *p2p.Server\n\tshh *whisper.Whisper\n\tdone chan struct{}\n\tmailServer mailserver.WMailServer\n\tentropy [entropySize]byte\n\n\tinput = bufio.NewReader(os.Stdin)\n)\n\n//加密\nvar (\n\tsymKey []byte\n\tpub *ecdsa.PublicKey\n\tasymKey *ecdsa.PrivateKey\n\tnodeid *ecdsa.PrivateKey\n\ttopic whisper.TopicType\n\n\tasymKeyID string\n\tasymFilterID string\n\tsymFilterID string\n\tsymPass string\n\tmsPassword string\n)\n\n//CMD参数\nvar (\n\tbootstrapMode = flag.Bool(\"standalone\", false, \"boostrap node: don''t initiate connection to peers, just wait for incoming connections\")\n\tforwarderMode = flag.Bool(\"forwarder\", false, \"forwarder mode: only forward messages, neither encrypt nor decrypt messages\")\n\tmailServerMode = flag.Bool(\"mailserver\", false, \"mail server mode: delivers expired messages on demand\")\n\trequestMail = flag.Bool(\"mailclient\", false, \"request expired messages from the bootstrap server\")\n\tasymmetricMode = flag.Bool(\"asym\", false, \"use asymmetric encryption\")\n\tgenerateKey = flag.Bool(\"generatekey\", false, \"generate and show the private key\")\n\tfileExMode = flag.Bool(\"fileexchange\", false, \"file exchange mode\")\n\tfileReader = flag.Bool(\"filereader\", false, \"load and decrypt messages saved as files, display as plain text\")\n\ttestMode = flag.Bool(\"test\", false, \"use of predefined parameters for diagnostics (password, etc.)\")\n\techoMode = flag.Bool(\"echo\", false, \"echo mode: prints some arguments for diagnostics\")\n\n\targVerbosity = flag.Int(\"verbosity\", int(log.LvlError), \"log verbosity level\")\n\targTTL = flag.Uint(\"ttl\", 30, \"time-to-live for messages in seconds\")\n\targWorkTime = flag.Uint(\"work\", 5, \"work time in seconds\")\n\targMaxSize = flag.Uint(\"maxsize\", uint(whisper.DefaultMaxMessageSize), \"max size of message\")\n\targPoW = flag.Float64(\"pow\", whisper.DefaultMinimumPoW, \"PoW for normal messages in float format (e.g. 2.7)\")\n\targServerPoW = flag.Float64(\"mspow\", whisper.DefaultMinimumPoW, \"PoW requirement for Mail Server request\")\n\n\targIP = flag.String(\"ip\", \"\", \"IP address and port of this node (e.g. 127.0.0.1:30303)\")\n\targPub = flag.String(\"pub\", \"\", \"public key for asymmetric encryption\")\n\targDBPath = flag.String(\"dbpath\", \"\", \"path to the server''s DB directory\")\n\targIDFile = flag.String(\"idfile\", \"\", \"file name with node id (private key)\")\nargEnode = flag.String(\"boot\", \"\", \"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\n\targTopic = flag.String(\"topic\", \"\", \"topic in hexadecimal format (e.g. 70a4beef)\")\n\targSaveDir = flag.String(\"savedir\", \"\", \"directory where all incoming messages will be saved as files\")\n)\n\nfunc main() {\n\tprocessArgs()\n\tinitialize()\n\trun()\n\tshutdown()\n}\n\nfunc processArgs() {\n\tflag.Parse()\n\n\tif len(*argIDFile) \u003e 0 {\n\t\tvar err error\n\t\tnodeid, err = crypto.LoadECDSA(*argIDFile)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to load file [%s]: %s.\", *argIDFile, err)\n\t\t}\n\t}\n\nconst enodePrefix = \"enode://“\n\tif len(*argEnode) \u003e 0 {\n\t\tif (*argEnode)[:len(enodePrefix)] != enodePrefix {\n\t\t\t*argEnode = enodePrefix + *argEnode\n\t\t}\n\t}\n\n\tif len(*argTopic) \u003e 0 {\n\t\tx, err := hex.DecodeString(*argTopic)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to parse the topic: %s\", err)\n\t\t}\n\t\ttopic = whisper.BytesToTopic(x)\n\t}\n\n\tif *asymmetricMode \u0026\u0026 len(*argPub) \u003e 0 {\n\t\tvar err error\n\t\tif pub, err = crypto.UnmarshalPubkey(common.FromHex(*argPub)); err != nil {\n\t\t\tutils.Fatalf(\"invalid public key\")\n\t\t}\n\t}\n\n\tif len(*argSaveDir) \u003e 0 {\n\t\tif _, err := os.Stat(*argSaveDir); os.IsNotExist(err) {\n\t\t\tutils.Fatalf(\"Download directory ''%s'' does not exist\", *argSaveDir)\n\t\t}\n\t} else if *fileExMode {\n\t\tutils.Fatalf(\"Parameter ''savedir'' is mandatory for file exchange mode\")\n\t}\n\n\tif *echoMode {\n\t\techo()\n\t}\n}\n\nfunc echo() {\n\tfmt.Printf(\"ttl = %d \\n\", *argTTL)\n\tfmt.Printf(\"workTime = %d \\n\", *argWorkTime)\n\tfmt.Printf(\"pow = %f \\n\", *argPoW)\n\tfmt.Printf(\"mspow = %f \\n\", *argServerPoW)\n\tfmt.Printf(\"ip = %s \\n\", *argIP)\n\tfmt.Printf(\"pub = %s \\n\", common.ToHex(crypto.FromECDSAPub(pub)))\n\tfmt.Printf(\"idfile = %s \\n\", *argIDFile)\n\tfmt.Printf(\"dbpath = %s \\n\", *argDBPath)\n\tfmt.Printf(\"boot = %s \\n\", *argEnode)\n}\n\nfunc initialize() {\n\tlog.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*argVerbosity), log.StreamHandler(os.Stderr, log.TerminalFormat(false))))\n\n\tdone = make(chan struct{})\n\tvar peers []*discover.Node\n\tvar err error\n\n\tif *generateKey {\n\t\tkey, err := crypto.GenerateKey()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate private key: %s\", err)\n\t\t}\n\t\tk := hex.EncodeToString(crypto.FromECDSA(key))\n\t\tfmt.Printf(\"Random private key: %s \\n\", k)\n\t\tos.Exit(0)\n\t}\n\n\tif *testMode {\nsymPass = \"wwww\" //ASCII码:0x77777777\n\t\tmsPassword = \"wwww\"\n\t}\n\n\tif *bootstrapMode {\n\t\tif len(*argIP) == 0 {\n\t\t\targIP = scanLineA(\"Please enter your IP and port (e.g. 127.0.0.1:30348): \")\n\t\t}\n\t} else if *fileReader {\n\t\t*bootstrapMode = true\n\t} else {\n\t\tif len(*argEnode) == 0 {\n\t\t\targEnode = scanLineA(\"Please enter the peer''s enode: \")\n\t\t}\n\t\tpeer := discover.MustParseNode(*argEnode)\n\t\tpeers = append(peers, peer)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tcfg := \u0026whisper.Config{\n\t\tMaxMessageSize: uint32(*argMaxSize),\n\t\tMinimumAcceptedPOW: *argPoW,\n\t}\n\n\tshh = whisper.New(cfg)\n\n\tif *argPoW != whisper.DefaultMinimumPoW {\n\t\terr := shh.SetMinimumPoW(*argPoW)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set PoW: %s\", err)\n\t\t}\n\t}\n\n\tif uint32(*argMaxSize) != whisper.DefaultMaxMessageSize {\n\t\terr := shh.SetMaxMessageSize(uint32(*argMaxSize))\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set max message size: %s\", err)\n\t\t}\n\t}\n\n\tasymKeyID, err = shh.NewKeyPair()\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t}\n\n\tasymKey, err = shh.GetPrivateKey(asymKeyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t}\n\n\tif nodeid == nil {\n\t\ttmpID, err := shh.NewKeyPair()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t\t}\n\n\t\tnodeid, err = shh.GetPrivateKey(tmpID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t\t}\n\t}\n\n\tmaxPeers := 80\n\tif *bootstrapMode {\n\t\tmaxPeers = 800\n\t}\n\n\t_, err = crand.Read(entropy[:])\n\tif err != nil {\n\t\tutils.Fatalf(\"crypto/rand failed: %s\", err)\n\t}\n\n\tif *mailServerMode {\n\t\tshh.RegisterServer(\u0026mailServer)\n\t\tif err := mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW); err != nil {\n\t\t\tutils.Fatalf(\"Failed to init MailServer: %s\", err)\n\t\t}\n\t}\n\n\tserver = \u0026p2p.Server{\n\t\tConfig: p2p.Config{\n\t\t\tPrivateKey: nodeid,\n\t\t\tMaxPeers: maxPeers,\n\t\t\tName: common.MakeName(\"wnode\", \"6.0\"),\n\t\t\tProtocols: shh.Protocols(),\n\t\t\tListenAddr: *argIP,\n\t\t\tNAT: nat.Any(),\n\t\t\tBootstrapNodes: peers,\n\t\t\tStaticNodes: peers,\n\t\t\tTrustedNodes: peers,\n\t\t},\n\t}\n}\n\nfunc startServer() error {\n\terr := server.Start()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to start Whisper peer: %s.\", err)\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"my public key: %s \\n\", common.ToHex(crypto.FromECDSAPub(\u0026asymKey.PublicKey)))\n\tfmt.Println(server.NodeInfo().Enode)\n\n\tif *bootstrapMode {\n\t\tconfigureNode()\n\t\tfmt.Println(\"Bootstrap Whisper node started\")\n\t} else {\n\t\tfmt.Println(\"Whisper node started\")\n//首先看看我们是否可以建立连接,然后请求用户输入\n\t\twaitForConnection(true)\n\t\tconfigureNode()\n\t}\n\n\tif *fileExMode {\n\t\tfmt.Printf(\"Please type the file name to be send. To quit type: ''%s''\\n\", quitCommand)\n\t} else if *fileReader {\n\t\tfmt.Printf(\"Please type the file name to be decrypted. To quit type: ''%s''\\n\", quitCommand)\n\t} else if !*forwarderMode {\n\t\tfmt.Printf(\"Please type the message. To quit type: ''%s''\\n\", quitCommand)\n\t}\n\treturn nil\n}\n\nfunc configureNode() {\n\tvar err error\n\tvar p2pAccept bool\n\n\tif *forwarderMode {\n\t\treturn\n\t}\n\n\tif *asymmetricMode {\n\t\tif len(*argPub) == 0 {\n\t\t\ts := scanLine(\"Please enter the peer''s public key: \")\n\t\t\tb := common.FromHex(s)\n\t\t\tif b == nil {\n\t\t\t\tutils.Fatalf(\"Error: can not convert hexadecimal string\")\n\t\t\t}\n\t\t\tif pub, err = crypto.UnmarshalPubkey(b); err != nil {\n\t\t\t\tutils.Fatalf(\"Error: invalid peer public key\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif *requestMail {\n\t\tp2pAccept = true\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !*asymmetricMode \u0026\u0026 !*forwarderMode {\n\t\tif len(symPass) == 0 {\n\t\t\tsymPass, err = console.Stdin.PromptPassword(\"Please enter the password for symmetric encryption: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read passphrase: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tsymKeyID, err := shh.AddSymKeyFromPassword(symPass)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to create symmetric key: %s\", err)\n\t\t}\n\t\tsymKey, err = shh.GetSymKey(symKeyID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to save symmetric key: %s\", err)\n\t\t}\n\t\tif len(*argTopic) == 0 {\n\t\t\tgenerateTopic([]byte(symPass))\n\t\t}\n\n\t\tfmt.Printf(\"Filter is configured for the topic: %x \\n\", topic)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(*argDBPath) == 0 {\n\t\t\targDBPath = scanLineA(\"Please enter the path to DB file: \")\n\t\t}\n\t}\n\n\tsymFilter := whisper.Filter{\n\t\tKeySym: symKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tsymFilterID, err = shh.Subscribe(\u0026symFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n\n\tasymFilter := whisper.Filter{\n\t\tKeyAsym: asymKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tasymFilterID, err = shh.Subscribe(\u0026asymFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n}\n\nfunc generateTopic(password []byte) {\n\tx := pbkdf2.Key(password, password, 4096, 128, sha512.New)\n\tfor i := 0; i \u003c len(x); i++ {\n\t\ttopic[i%whisper.TopicLength] ^= x[i]\n\t}\n}\n\nfunc waitForConnection(timeout bool) {\n\tvar cnt int\n\tvar connected bool\n\tfor !connected {\n\t\ttime.Sleep(time.Millisecond * 50)\n\t\tconnected = server.PeerCount() \u003e 0\n\t\tif timeout {\n\t\t\tcnt++\n\t\t\tif cnt \u003e 1000 {\n\t\t\t\tutils.Fatalf(\"Timeout expired, failed to connect\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"Connected to peer.\")\n}\n\nfunc run() {\n\terr := startServer()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer server.Stop()\n\tshh.Start(nil)\n\tdefer shh.Stop()\n\n\tif !*forwarderMode {\n\t\tgo messageLoop()\n\t}\n\n\tif *requestMail {\n\t\trequestExpiredMessagesLoop()\n\t} else if *fileExMode {\n\t\tsendFilesLoop()\n\t} else if *fileReader {\n\t\tfileReaderLoop()\n\t} else {\n\t\tsendLoop()\n\t}\n}\n\nfunc shutdown() {\n\tclose(done)\n\tmailServer.Close()\n}\n\nfunc sendLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tsendMsg([]byte(s))\n\t\tif *asymmetricMode {\n//为方便起见,请打印您自己的消息,\n//因为在非对称模式下是不可能解密的\n\t\t\ttimestamp := time.Now().Unix()\n\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: %s\\n\", timestamp, from, s)\n\t\t}\n\t}\n}\n\nfunc sendFilesLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tb, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\n\t\t\th := sendMsg(b)\n\t\t\tif (h == common.Hash{}) {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: message was not sent \\n\")\n\t\t\t} else {\n\t\t\t\ttimestamp := time.Now().Unix()\n\t\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: sent message with hash %x\\n\", timestamp, from, h)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc fileReaderLoop() {\n\twatcher1 := shh.GetFilter(symFilterID)\n\twatcher2 := shh.GetFilter(asymFilterID)\n\tif watcher1 == nil \u0026\u0026 watcher2 == nil {\n\t\tfmt.Println(\"Error: neither symmetric nor asymmetric filter is installed\")\n\t\treturn\n\t}\n\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\traw, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\nenv := whisper.Envelope{Data: raw} //主题为零\nmsg := env.Open(watcher1) //不管主题如何,都强制打开信封\n\t\t\tif msg == nil {\n\t\t\t\tmsg = env.Open(watcher2)\n\t\t\t}\n\t\t\tif msg == nil {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: failed to decrypt the message \\n\")\n\t\t\t} else {\n\t\t\t\tprintMessageInfo(msg)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc scanLine(prompt string) string {\n\tif len(prompt) \u003e 0 {\n\t\tfmt.Print(prompt)\n\t}\n\ttxt, err := input.ReadString(''\\n'')\n\tif err != nil {\n\t\tutils.Fatalf(\"input error: %s\", err)\n\t}\n\ttxt = strings.TrimRight(txt, \"\\n\\r\")\n\treturn txt\n}\n\nfunc scanLineA(prompt string) *string {\n\ts := scanLine(prompt)\n\treturn \u0026s\n}\n\nfunc scanUint(prompt string) uint32 {\n\ts := scanLine(prompt)\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Fail to parse the lower time limit: %s\", err)\n\t}\n\treturn uint32(i)\n}\n\nfunc sendMsg(payload []byte) common.Hash {\n\tparams := whisper.MessageParams{\n\t\tSrc: asymKey,\n\t\tDst: pub,\n\t\tKeySym: symKey,\n\t\tPayload: payload,\n\t\tTopic: topic,\n\t\tTTL: uint32(*argTTL),\n\t\tPoW: *argPoW,\n\t\tWorkTime: uint32(*argWorkTime),\n\t}\n\n\tmsg, err := whisper.NewSentMessage(\u0026params)\n\tif err != nil {\n\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t}\n\n\tenvelope, err := msg.Wrap(\u0026params)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to seal message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\terr = shh.Send(envelope)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to send message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\treturn envelope.Hash()\n}\n\nfunc messageLoop() {\n\tsf := shh.GetFilter(symFilterID)\n\tif sf == nil {\n\t\tutils.Fatalf(\"symmetric filter is not installed\")\n\t}\n\n\taf := shh.GetFilter(asymFilterID)\n\tif af == nil {\n\t\tutils.Fatalf(\"asymmetric filter is not installed\")\n\t}\n\n\tticker := time.NewTicker(time.Millisecond * 50)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-ticker.C:\n\t\t\tm1 := sf.Retrieve()\n\t\t\tm2 := af.Retrieve()\n\t\t\tmessages := append(m1, m2...)\n\t\t\tfor _, msg := range messages {\n\t\t\t\treportedOnce := false\n\t\t\t\tif !*fileExMode \u0026\u0026 len(msg.Payload) \u003c= 2048 {\n\t\t\t\t\tprintMessageInfo(msg)\n\t\t\t\t\treportedOnce = true\n\t\t\t\t}\n\n//在指定argsavedir时保存所有消息。\n//\n//如果fileexmode==true,则只显示哈希值,因为消息可能太大。\n\t\t\t\tif len(*argSaveDir) \u003e 0 {\n\t\t\t\t\twriteMessageToFile(*argSaveDir, msg, !reportedOnce)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc printMessageInfo(msg *whisper.ReceivedMessage) {\ntimestamp := fmt.Sprintf(\"%d\", msg.Sent) //用于诊断的Unix时间戳\n\ttext := string(msg.Payload)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tif whisper.IsPubKeyEqual(msg.Src, \u0026asymKey.PublicKey) {\nfmt.Printf(\"\\n%s \u003c%x\u003e: %s\\n\", timestamp, address, text) //我的信息\n\t} else {\nfmt.Printf(\"\\n%s [%x]: %s\\n\", timestamp, address, text) //\n\t}\n}\n\nfunc writeMessageToFile(dir string, msg *whisper.ReceivedMessage, show bool) {\n\tif len(dir) == 0 {\n\t\treturn\n\t}\n\n\ttimestamp := fmt.Sprintf(\"%d\", msg.Sent)\n\tname := fmt.Sprintf(\"%x\", msg.EnvelopeHash)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tenv := shh.GetEnvelope(msg.EnvelopeHash)\n\tif env == nil {\n\t\tfmt.Printf(\"\\nUnexpected error: envelope not found: %x\\n\", msg.EnvelopeHash)\n\t\treturn\n\t}\n\n//这是一个示例代码;如果不想保存自己的消息,请取消注释。\n//如果whisper.ispubkeyequal(msg.src,\u0026asymkey.publickey)\n//fmt.printf(“\\n%s\u003c%x\u003e:我收到的消息,未保存:“%s''\\n”,时间戳,地址,名称)\n//返回\n//}\n\n\tfullpath := filepath.Join(dir, name)\n\terr := ioutil.WriteFile(fullpath, env.Data, 0644)\n\tif err != nil {\n\t\tfmt.Printf(\"\\n%s {%x}: message received but not saved: %s\\n\", timestamp, address, err)\n\t} else if show {\n\t\tfmt.Printf(\"\\n%s {%x}: message received and saved as ''%s'' (%d bytes)\\n\", timestamp, address, name, len(env.Data))\n\t}\n}\n\nfunc requestExpiredMessagesLoop() {\n\tvar key, peerID, bloom []byte\n\tvar timeLow, timeUpp uint32\n\tvar t string\n\tvar xt whisper.TopicType\n\n\tkeyID, err := shh.AddSymKeyFromPassword(msPassword)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to create symmetric key for mail request: %s\", err)\n\t}\n\tkey, err = shh.GetSymKey(keyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to save symmetric key for mail request: %s\", err)\n\t}\n\tpeerID = extractIDFromEnode(*argEnode)\n\tshh.AllowP2PMessagesFromPeer(peerID)\n\n\tfor {\n\t\ttimeLow = scanUint(\"Please enter the lower limit of the time range (unix timestamp): \")\n\t\ttimeUpp = scanUint(\"Please enter the upper limit of the time range (unix timestamp): \")\n\t\tt = scanLine(\"Enter the topic (hex). Press enter to request all messages, regardless of the topic: \")\n\t\tif len(t) == whisper.TopicLength*2 {\n\t\t\tx, err := hex.DecodeString(t)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to parse the topic: %s \\n\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txt = whisper.BytesToTopic(x)\n\t\t\tbloom = whisper.TopicToBloom(xt)\n\t\t\tobfuscateBloom(bloom)\n\t\t} else if len(t) == 0 {\n\t\t\tbloom = whisper.MakeFullNodeBloom()\n\t\t} else {\n\t\t\tfmt.Println(\"Error: topic is invalid, request aborted\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif timeUpp == 0 {\n\t\t\ttimeUpp = 0xFFFFFFFF\n\t\t}\n\n\t\tdata := make([]byte, 8, 8+whisper.BloomFilterSize)\n\t\tbinary.BigEndian.PutUint32(data, timeLow)\n\t\tbinary.BigEndian.PutUint32(data[4:], timeUpp)\n\t\tdata = append(data, bloom...)\n\n\t\tvar params whisper.MessageParams\n\t\tparams.PoW = *argServerPoW\n\t\tparams.Payload = data\n\t\tparams.KeySym = key\n\t\tparams.Src = asymKey\n\t\tparams.WorkTime = 5\n\n\t\tmsg, err := whisper.NewSentMessage(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t\t}\n\t\tenv, err := msg.Wrap(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Wrap failed: %s\", err)\n\t\t}\n\n\t\terr = shh.RequestHistoricMessages(peerID, env)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to send P2P message: %s\", err)\n\t\t}\n\n\t\ttime.Sleep(time.Second * 5)\n\t}\n}\n\nfunc extractIDFromEnode(s string) []byte {\n\tn, err := discover.ParseNode(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to parse enode: %s\", err)\n\t}\n\treturn n.ID[:]\n}\n\n//模糊布卢姆增加16个随机位的布卢姆\n//筛选,以便混淆包含的主题。\n//它在每个会话中都具有确定性。\n//尽管有额外的位,它将平均匹配\n//比完整节点的Bloom过滤器少32000倍的消息。\nfunc obfuscateBloom(bloom []byte) {\n\tconst half = entropySize / 2\n\tfor i := 0; i \u003c half; i++ {\n\t\tx := int(entropy[i])\n\t\tif entropy[half+i] \u003c 128 {\n\t\t\tx += 256\n\t\t}\n\nbloom[x/8] = 1 \u003c\u003c uint(x%8) //设置位号x\n\t}\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":116,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/erigontech/erigon"},"file":{"path":"cmd/evm/internal/t8ntool/transition.go","url":"/github.com/erigontech/erigon/-/blob/cmd/evm/internal/t8ntool/transition.go","content":"// Copyright 2020 The go-ethereum Authors\n// (original work)\n// Copyright 2024 The Erigon Authors\n// (modifications)\n// This file is part of Erigon.\n//\n// Erigon is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Erigon is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with Erigon. If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\npackage t8ntool\n\nimport (\n\t\"context\"\n\t\"crypto/ecdsa\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math/big\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\n\t\"github.com/holiman/uint256\"\n\t\"github.com/urfave/cli/v2\"\n\n\t\"github.com/erigontech/erigon/common\"\n\t\"github.com/erigontech/erigon/common/crypto\"\n\t\"github.com/erigontech/erigon/common/hexutil\"\n\t\"github.com/erigontech/erigon/common/length\"\n\t\"github.com/erigontech/erigon/common/log/v3\"\n\t\"github.com/erigontech/erigon/common/math\"\n\t\"github.com/erigontech/erigon/core\"\n\t\"github.com/erigontech/erigon/core/state\"\n\t\"github.com/erigontech/erigon/core/tracing\"\n\t\"github.com/erigontech/erigon/core/vm\"\n\t\"github.com/erigontech/erigon/core/vm/evmtypes\"\n\t\"github.com/erigontech/erigon/db/datadir\"\n\t\"github.com/erigontech/erigon/db/kv\"\n\t\"github.com/erigontech/erigon/db/kv/rawdbv3\"\n\t\"github.com/erigontech/erigon/db/kv/temporal/temporaltest\"\n\tdbstate \"github.com/erigontech/erigon/db/state\"\n\t\"github.com/erigontech/erigon/eth/consensuschain\"\n\ttrace_logger \"github.com/erigontech/erigon/eth/tracers/logger\"\n\t\"github.com/erigontech/erigon/execution/chain\"\n\t\"github.com/erigontech/erigon/execution/consensus/ethash\"\n\t\"github.com/erigontech/erigon/execution/consensus/merge\"\n\t\"github.com/erigontech/erigon/execution/rlp\"\n\t\"github.com/erigontech/erigon/execution/tests/testutil\"\n\t\"github.com/erigontech/erigon/execution/types\"\n\t\"github.com/erigontech/erigon/rpc/ethapi\"\n)\n\nconst (\n\tErrorEVM = 2\n\tErrorVMConfig = 3\n\tErrorMissingBlockhash = 4\n\n\tErrorJson = 10\n\tErrorIO = 11\n\n\tstdinSelector = \"stdin\"\n)\n\ntype NumberedError struct {\n\terrorCode int\n\terr error\n}\n\nfunc NewError(errorCode int, err error) *NumberedError {\n\treturn \u0026NumberedError{errorCode, err}\n}\n\nfunc (n *NumberedError) Error() string {\n\treturn fmt.Sprintf(\"ERROR(%d): %v\", n.errorCode, n.err.Error())\n}\n\nfunc (n *NumberedError) ExitCode() int {\n\treturn n.errorCode\n}\n\n// compile-time conformance test\nvar (\n\t_ cli.ExitCoder = (*NumberedError)(nil)\n)\n\ntype input struct {\n\tAlloc types.GenesisAlloc `json:\"alloc,omitempty\"`\n\tEnv *stEnv `json:\"env,omitempty\"`\n\tTxs []*txWithKey `json:\"txs,omitempty\"`\n}\n\nfunc Main(ctx *cli.Context) error {\n\tlog.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StderrHandler))\n\tvar (\n\t\terr error\n\t\tbaseDir = \"\"\n\t)\n\tvar getTracer func(txIndex int, txHash common.Hash) (*tracing.Hooks, error)\n\n\t// If user specified a basedir, make sure it exists\n\tif ctx.IsSet(OutputBasedir.Name) {\n\t\tif base := ctx.String(OutputBasedir.Name); len(base) \u003e 0 {\n\t\t\terr2 := os.MkdirAll(base, 0755) // //rw-r--r--\n\t\t\tif err2 != nil {\n\t\t\t\treturn NewError(ErrorIO, fmt.Errorf(\"failed creating output basedir: %v\", err2))\n\t\t\t}\n\t\t\tbaseDir = base\n\t\t}\n\t}\n\tif ctx.Bool(TraceFlag.Name) {\n\t\t// Configure the EVM logger\n\t\tlogConfig := \u0026trace_logger.LogConfig{\n\t\t\tDisableStack: ctx.Bool(TraceDisableStackFlag.Name),\n\t\t\tDisableMemory: ctx.Bool(TraceDisableMemoryFlag.Name),\n\t\t\tDisableReturnData: ctx.Bool(TraceDisableReturnDataFlag.Name),\n\t\t\tDebug: true,\n\t\t}\n\t\tvar prevFile *os.File\n\t\t// This one closes the last file\n\t\tdefer func() {\n\t\t\tif prevFile != nil {\n\t\t\t\tprevFile.Close()\n\t\t\t}\n\t\t}()\n\t\tgetTracer = func(txIndex int, txHash common.Hash) (*tracing.Hooks, error) {\n\t\t\tif prevFile != nil {\n\t\t\t\tprevFile.Close()\n\t\t\t}\n\t\t\ttraceFile, err2 := os.Create(path.Join(baseDir, fmt.Sprintf(\"trace-%d-%v.jsonl\", txIndex, txHash.String())))\n\t\t\tif err2 != nil {\n\t\t\t\treturn nil, NewError(ErrorIO, fmt.Errorf(\"failed creating trace-file: %v\", err2))\n\t\t\t}\n\t\t\tprevFile = traceFile\n\t\t\treturn trace_logger.NewJSONLogger(logConfig, traceFile).Tracer().Hooks, nil\n\t\t}\n\t} else {\n\t\tgetTracer = func(txIndex int, txHash common.Hash) (tracer *tracing.Hooks, err error) {\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\t// We need to load three things: alloc, env and transactions. May be either in\n\t// stdin input or in files.\n\t// Check if anything needs to be read from stdin\n\tvar (\n\t\tprestate Prestate\n\t\ttxs types.Transactions // txs to apply\n\t\tallocStr = ctx.String(InputAllocFlag.Name)\n\n\t\tenvStr = ctx.String(InputEnvFlag.Name)\n\t\ttxStr = ctx.String(InputTxsFlag.Name)\n\t\tinputData = \u0026input{}\n\t)\n\t// Figure out the prestate alloc\n\tif allocStr == stdinSelector || envStr == stdinSelector || txStr == stdinSelector {\n\t\tdecoder := json.NewDecoder(os.Stdin)\n\t\tdecoder.Decode(inputData) //nolint:errcheck\n\t}\n\tif allocStr != stdinSelector {\n\t\tinFile, err1 := os.Open(allocStr)\n\t\tif err1 != nil {\n\t\t\treturn NewError(ErrorIO, fmt.Errorf(\"failed reading alloc file: %v\", err1))\n\t\t}\n\t\tdefer inFile.Close()\n\t\tdecoder := json.NewDecoder(inFile)\n\t\tif err = decoder.Decode(\u0026inputData.Alloc); err != nil {\n\t\t\treturn NewError(ErrorJson, fmt.Errorf(\"failed unmarshaling alloc-file: %v\", err))\n\t\t}\n\t}\n\n\tprestate.Pre = inputData.Alloc\n\n\t// Set the block environment\n\tif envStr != stdinSelector {\n\t\tinFile, err1 := os.Open(envStr)\n\t\tif err1 != nil {\n\t\t\treturn NewError(ErrorIO, fmt.Errorf(\"failed reading env file: %v\", err1))\n\t\t}\n\t\tdefer inFile.Close()\n\t\tdecoder := json.NewDecoder(inFile)\n\t\tvar env stEnv\n\t\tif err = decoder.Decode(\u0026env); err != nil {\n\t\t\treturn NewError(ErrorJson, fmt.Errorf(\"failed unmarshaling env-file: %v\", err))\n\t\t}\n\t\tinputData.Env = \u0026env\n\t}\n\tprestate.Env = *inputData.Env\n\n\tvmConfig := vm.Config{\n\t\tTracer: nil,\n\t\tStatelessExec: true,\n\t}\n\t// Construct the chainconfig\n\tvar chainConfig *chain.Config\n\tif cConf, extraEips, err1 := testutil.GetChainConfig(ctx.String(ForknameFlag.Name)); err1 != nil {\n\t\treturn NewError(ErrorVMConfig, fmt.Errorf(\"failed constructing chain configuration: %v\", err1))\n\t} else {\n\t\tchainConfig = cConf\n\t\tvmConfig.ExtraEips = extraEips\n\t}\n\t// Set the chain id\n\tchainConfig.ChainID = big.NewInt(ctx.Int64(ChainIDFlag.Name))\n\n\tvar txsWithKeys []*txWithKey\n\tif txStr != stdinSelector {\n\t\tinFile, err1 := os.Open(txStr)\n\t\tif err1 != nil {\n\t\t\treturn NewError(ErrorIO, fmt.Errorf(\"failed reading txs file: %v\", err1))\n\t\t}\n\t\tdefer inFile.Close()\n\t\tdecoder := json.NewDecoder(inFile)\n\t\tif err = decoder.Decode(\u0026txsWithKeys); err != nil {\n\t\t\treturn NewError(ErrorJson, fmt.Errorf(\"failed unmarshaling txs-file: %v\", err))\n\t\t}\n\t} else {\n\t\ttxsWithKeys = inputData.Txs\n\t}\n\t// We may have to sign the transactions.\n\tsigner := types.MakeSigner(chainConfig, prestate.Env.Number, prestate.Env.Timestamp)\n\n\tif txs, err = signUnsignedTransactions(txsWithKeys, *signer); err != nil {\n\t\treturn NewError(ErrorJson, fmt.Errorf(\"failed signing transactions: %v\", err))\n\t}\n\n\teip1559 := chainConfig.IsLondon(prestate.Env.Number)\n\t// Sanity check, to not `panic` in state_transition\n\tif eip1559 {\n\t\tif prestate.Env.BaseFee == nil {\n\t\t\treturn NewError(ErrorVMConfig, errors.New(\"EIP-1559 config but missing ''currentBaseFee'' in env section\"))\n\t\t}\n\t} else {\n\t\tprestate.Env.Random = nil\n\t}\n\n\tif chainConfig.IsShanghai(prestate.Env.Timestamp) \u0026\u0026 prestate.Env.Withdrawals == nil {\n\t\treturn NewError(ErrorVMConfig, errors.New(\"shanghai config but missing ''withdrawals'' in env section\"))\n\t}\n\n\tisMerged := chainConfig.TerminalTotalDifficulty != nil \u0026\u0026 chainConfig.TerminalTotalDifficulty.BitLen() == 0\n\tenv := prestate.Env\n\tif isMerged {\n\t\t// post-merge:\n\t\t// - random must be supplied\n\t\t// - difficulty must be zero\n\t\tswitch {\n\t\tcase env.Random == nil:\n\t\t\treturn NewError(ErrorVMConfig, errors.New(\"post-merge requires currentRandom to be defined in env\"))\n\t\tcase env.Difficulty != nil \u0026\u0026 env.Difficulty.BitLen() != 0:\n\t\t\treturn NewError(ErrorVMConfig, errors.New(\"post-merge difficulty must be zero (or omitted) in env\"))\n\t\t}\n\t\tprestate.Env.Difficulty = nil\n\t} else if env.Difficulty == nil {\n\t\t// If difficulty was not provided by caller, we need to calculate it.\n\t\tswitch {\n\t\tcase env.ParentDifficulty == nil:\n\t\t\treturn NewError(ErrorVMConfig, errors.New(\"currentDifficulty was not provided, and cannot be calculated due to missing parentDifficulty\"))\n\t\tcase env.Number == 0:\n\t\t\treturn NewError(ErrorVMConfig, errors.New(\"currentDifficulty needs to be provided for block number 0\"))\n\t\tcase env.Timestamp \u003c= env.ParentTimestamp:\n\t\t\treturn NewError(ErrorVMConfig, fmt.Errorf(\"currentDifficulty cannot be calculated -- currentTime (%d) needs to be after parent time (%d)\",\n\t\t\t\tenv.Timestamp, env.ParentTimestamp))\n\t\t}\n\t\tprestate.Env.Difficulty = calcDifficulty(chainConfig, env.Number, env.Timestamp,\n\t\t\tenv.ParentTimestamp, env.ParentDifficulty, env.ParentUncleHash)\n\t}\n\n\t// manufacture block from above inputs\n\theader := NewHeader(prestate.Env)\n\n\tvar ommerHeaders = make([]*types.Header, len(prestate.Env.Ommers))\n\theader.Number.Add(header.Number, big.NewInt(int64(len(prestate.Env.Ommers))))\n\tfor i, ommer := range prestate.Env.Ommers {\n\t\tvar ommerN big.Int\n\t\tommerN.SetUint64(header.Number.Uint64() - ommer.Delta)\n\t\tommerHeaders[i] = \u0026types.Header{Coinbase: ommer.Address, Number: \u0026ommerN}\n\t}\n\tblock := types.NewBlock(header, txs, ommerHeaders, nil /* receipts */, prestate.Env.Withdrawals)\n\n\tgetHash := func(num uint64) (common.Hash, error) {\n\t\tif prestate.Env.BlockHashes == nil {\n\t\t\treturn common.Hash{}, fmt.Errorf(\"getHash(%d) invoked, no blockhashes provided\", num)\n\t\t}\n\t\th, ok := prestate.Env.BlockHashes[math.HexOrDecimal64(num)]\n\t\tif !ok {\n\t\t\treturn common.Hash{}, fmt.Errorf(\"getHash(%d) invoked, blockhash for that block not provided\", num)\n\t\t}\n\t\treturn h, nil\n\t}\n\n\tdb := temporaltest.NewTestDB(nil, datadir.New(\"\"))\n\tdefer db.Close()\n\n\ttx, err := db.BeginTemporalRw(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer tx.Rollback()\n\n\tsd, err := dbstate.NewSharedDomains(tx, log.New())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer sd.Close()\n\n\tblockNum, txNum := uint64(0), uint64(0)\n\tsd.SetTxNum(txNum)\n\tsd.SetBlockNum(blockNum)\n\treader, writer := MakePreState((\u0026evmtypes.BlockContext{}).Rules(chainConfig), tx, sd, prestate.Pre, blockNum, txNum)\n\tblockNum, txNum = uint64(1), uint64(2)\n\tsd.SetTxNum(txNum)\n\tsd.SetBlockNum(blockNum)\n\n\t// Merge engine can be used for pre-merge blocks as well, as it\n\t// redirects to the ethash engine based on the block number\n\tengine := merge.New(\u0026ethash.FakeEthash{})\n\n\tt8logger := log.New(\"t8ntool\")\n\tchainReader := consensuschain.NewReader(chainConfig, tx, nil, t8logger)\n\tresult, err := core.ExecuteBlockEphemerally(chainConfig, \u0026vmConfig, getHash, engine, block, reader, writer, chainReader, getTracer, t8logger)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error on EBE: %w\", err)\n\t}\n\n\t// state root calculation\n\troot, err := CalculateStateRoot(tx, blockNum, txNum)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresult.StateRoot = *root\n\n\t// Dump the execution result\n\tbody, _ := rlp.EncodeToBytes(txs)\n\tcollector := make(Alloc)\n\n\tdumper := state.NewDumper(tx, rawdbv3.TxNums, prestate.Env.Number)\n\tdumper.DumpToCollector(collector, false, false, common.Address{}, 0)\n\treturn dispatchOutput(ctx, baseDir, result, collector, body)\n}\n\n// txWithKey is a helper-struct, to allow us to use the types.Transaction along with\n// a `secretKey`-field, for input\ntype txWithKey struct {\n\tkey *ecdsa.PrivateKey\n\ttx types.Transaction\n}\n\nfunc (t *txWithKey) UnmarshalJSON(input []byte) error {\n\t// Read the secretKey, if present\n\ttype sKey struct {\n\t\tKey *common.Hash `json:\"secretKey\"`\n\t}\n\tvar key sKey\n\tif err := json.Unmarshal(input, \u0026key); err != nil {\n\t\treturn err\n\t}\n\tif key.Key != nil {\n\t\tk := key.Key.Hex()[2:]\n\t\tif ecdsaKey, err := crypto.HexToECDSA(k); err == nil {\n\t\t\tt.key = ecdsaKey\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Now, read the transaction itself\n\tvar txJson ethapi.RPCTransaction\n\n\tif err := json.Unmarshal(input, \u0026txJson); err != nil {\n\t\treturn err\n\t}\n\n\t// assemble transaction\n\ttx, err := getTransaction(txJson)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.tx = tx\n\treturn nil\n}\n\nfunc getTransaction(txJson ethapi.RPCTransaction) (types.Transaction, error) {\n\tgasPrice, value := uint256.NewInt(0), uint256.NewInt(0)\n\tvar overflow bool\n\tvar chainId *uint256.Int\n\n\tif txJson.Value != nil {\n\t\tvalue, overflow = uint256.FromBig(txJson.Value.ToInt())\n\t\tif overflow {\n\t\t\treturn nil, errors.New(\"value field caused an overflow (uint256)\")\n\t\t}\n\t}\n\n\tif txJson.GasPrice != nil {\n\t\tgasPrice, overflow = uint256.FromBig(txJson.GasPrice.ToInt())\n\t\tif overflow {\n\t\t\treturn nil, errors.New(\"gasPrice field caused an overflow (uint256)\")\n\t\t}\n\t}\n\n\tif txJson.ChainID != nil {\n\t\tchainId, overflow = uint256.FromBig(txJson.ChainID.ToInt())\n\t\tif overflow {\n\t\t\treturn nil, errors.New(\"chainId field caused an overflow (uint256)\")\n\t\t}\n\t}\n\n\tcommonTx := types.CommonTx{\n\t\tNonce: uint64(txJson.Nonce),\n\t\tTo: txJson.To,\n\t\tValue: value,\n\t\tGasLimit: uint64(txJson.Gas),\n\t\tData: txJson.Input,\n\t}\n\n\tcommonTx.V.SetFromBig(txJson.V.ToInt())\n\tcommonTx.R.SetFromBig(txJson.R.ToInt())\n\tcommonTx.S.SetFromBig(txJson.S.ToInt())\n\tif txJson.Type == types.LegacyTxType || txJson.Type == types.AccessListTxType {\n\t\tif txJson.Type == types.LegacyTxType {\n\t\t\treturn \u0026types.LegacyTx{\n\t\t\t\tCommonTx: types.CommonTx{\n\t\t\t\t\tNonce: uint64(txJson.Nonce),\n\t\t\t\t\tTo: txJson.To,\n\t\t\t\t\tValue: value,\n\t\t\t\t\tGasLimit: uint64(txJson.Gas),\n\t\t\t\t\tData: txJson.Input,\n\t\t\t\t},\n\t\t\t\tGasPrice: gasPrice,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn \u0026types.AccessListTx{\n\t\t\tLegacyTx: types.LegacyTx{\n\t\t\t\tCommonTx: types.CommonTx{\n\t\t\t\t\tNonce: uint64(txJson.Nonce),\n\t\t\t\t\tTo: txJson.To,\n\t\t\t\t\tValue: value,\n\t\t\t\t\tGasLimit: uint64(txJson.Gas),\n\t\t\t\t\tData: txJson.Input,\n\t\t\t\t},\n\t\t\t\tGasPrice: gasPrice,\n\t\t\t},\n\t\t\tChainID: chainId,\n\t\t\tAccessList: *txJson.Accesses,\n\t\t}, nil\n\t} else if txJson.Type == types.DynamicFeeTxType || txJson.Type == types.SetCodeTxType {\n\t\tvar tipCap *uint256.Int\n\t\tvar feeCap *uint256.Int\n\t\tif txJson.MaxPriorityFeePerGas != nil {\n\t\t\ttipCap, overflow = uint256.FromBig(txJson.MaxPriorityFeePerGas.ToInt())\n\t\t\tif overflow {\n\t\t\t\treturn nil, errors.New(\"maxPriorityFeePerGas field caused an overflow (uint256)\")\n\t\t\t}\n\t\t}\n\n\t\tif txJson.MaxFeePerGas != nil {\n\t\t\tfeeCap, overflow = uint256.FromBig(txJson.MaxFeePerGas.ToInt())\n\t\t\tif overflow {\n\t\t\t\treturn nil, errors.New(\"maxFeePerGas field caused an overflow (uint256)\")\n\t\t\t}\n\t\t}\n\n\t\tif txJson.Type == types.DynamicFeeTxType {\n\t\t\treturn \u0026types.DynamicFeeTransaction{\n\t\t\t\tCommonTx: types.CommonTx{\n\t\t\t\t\tNonce: uint64(txJson.Nonce),\n\t\t\t\t\tTo: txJson.To,\n\t\t\t\t\tValue: value,\n\t\t\t\t\tGasLimit: uint64(txJson.Gas),\n\t\t\t\t\tData: txJson.Input,\n\t\t\t\t},\n\t\t\t\tChainID: chainId,\n\t\t\t\tTipCap: tipCap,\n\t\t\t\tFeeCap: feeCap,\n\t\t\t\tAccessList: *txJson.Accesses,\n\t\t\t}, nil\n\t\t}\n\n\t\tauths := make([]types.Authorization, 0)\n\t\tfor _, auth := range *txJson.Authorizations {\n\t\t\ta, err := auth.ToAuthorization()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tauths = append(auths, a)\n\t\t}\n\n\t\treturn \u0026types.SetCodeTransaction{\n\t\t\t// it''s ok to copy here - because it''s constructor of object - no parallel access yet\n\t\t\tDynamicFeeTransaction: types.DynamicFeeTransaction{\n\t\t\t\tCommonTx: types.CommonTx{\n\t\t\t\t\tNonce: uint64(txJson.Nonce),\n\t\t\t\t\tTo: txJson.To,\n\t\t\t\t\tValue: value,\n\t\t\t\t\tGasLimit: uint64(txJson.Gas),\n\t\t\t\t\tData: txJson.Input,\n\t\t\t\t},\n\t\t\t\tChainID: chainId,\n\t\t\t\tTipCap: tipCap,\n\t\t\t\tFeeCap: feeCap,\n\t\t\t\tAccessList: *txJson.Accesses,\n\t\t\t},\n\t\t\tAuthorizations: auths,\n\t\t}, nil\n\t} else {\n\t\treturn nil, nil\n\t}\n}\n\n// signUnsignedTransactions converts the input txs to canonical transactions.\n//\n// The transactions can have two forms, either\n// 1. unsigned or\n// 2. signed\n//\n// For (1), r, s, v, need so be zero, and the `secretKey` needs to be set.\n// If so, we sign it here and now, with the given `secretKey`\n// If the condition above is not met, then it''s considered a signed transaction.\n//\n// To manage this, we read the transactions twice, first trying to read the secretKeys,\n// and secondly to read them with the standard txn json format\nfunc signUnsignedTransactions(txs []*txWithKey, signer types.Signer) (types.Transactions, error) {\n\tvar signedTxs []types.Transaction\n\tfor i, txWithKey := range txs {\n\t\ttx := txWithKey.tx\n\t\tkey := txWithKey.key\n\t\tv, r, s := tx.RawSignatureValues()\n\t\tif key != nil \u0026\u0026 v.IsZero() \u0026\u0026 r.IsZero() \u0026\u0026 s.IsZero() {\n\t\t\t// This transaction needs to be signed\n\t\t\tsigned, err := types.SignTx(tx, signer, key)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, NewError(ErrorJson, fmt.Errorf(\"tx %d: failed to sign tx: %v\", i, err))\n\t\t\t}\n\t\t\tsignedTxs = append(signedTxs, signed)\n\t\t} else {\n\t\t\t// Already signed\n\t\t\tsignedTxs = append(signedTxs, tx)\n\t\t}\n\t}\n\treturn signedTxs, nil\n}\n\ntype Alloc map[common.Address]types.GenesisAccount\n\nfunc (g Alloc) OnRoot(common.Hash) {}\n\nfunc (g Alloc) OnAccount(addr common.Address, dumpAccount state.DumpAccount) {\n\tbalance, _ := new(big.Int).SetString(dumpAccount.Balance, 10)\n\tvar storage map[common.Hash]common.Hash\n\tif dumpAccount.Storage != nil {\n\t\tstorage = make(map[common.Hash]common.Hash)\n\t\tfor k, v := range dumpAccount.Storage {\n\t\t\tstorage[common.HexToHash(k)] = common.HexToHash(v)\n\t\t}\n\t}\n\tgenesisAccount := types.GenesisAccount{\n\t\tCode: dumpAccount.Code,\n\t\tStorage: storage,\n\t\tBalance: balance,\n\t\tNonce: dumpAccount.Nonce,\n\t}\n\tg[addr] = genesisAccount\n}\n\n// saveFile marshalls the object to the given file\nfunc saveFile(baseDir, filename string, data interface{}) error {\n\tb, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\treturn NewError(ErrorJson, fmt.Errorf(\"failed marshalling output: %v\", err))\n\t}\n\tlocation := filepath.Join(baseDir, filename)\n\tif err = os.WriteFile(location, b, 0644); err != nil { //nolint:gosec\n\t\treturn NewError(ErrorIO, fmt.Errorf(\"failed writing output: %v\", err))\n\t}\n\tlog.Info(\"Wrote file\", \"file\", location)\n\treturn nil\n}\n\n// dispatchOutput writes the output data to either stderr or stdout, or to the specified\n// files\nfunc dispatchOutput(ctx *cli.Context, baseDir string, result *core.EphemeralExecResult, alloc Alloc, body hexutil.Bytes) error {\n\tstdOutObject := make(map[string]interface{})\n\tstdErrObject := make(map[string]interface{})\n\tdispatch := func(baseDir, fName, name string, obj interface{}) error {\n\t\tswitch fName {\n\t\tcase \"stdout\":\n\t\t\tstdOutObject[name] = obj\n\t\tcase \"stderr\":\n\t\t\tstdErrObject[name] = obj\n\t\tcase \"\":\n\t\t\t// don''t save\n\t\tdefault: // save to file\n\t\t\tif err := saveFile(baseDir, fName, obj); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tif err := dispatch(baseDir, ctx.String(OutputAllocFlag.Name), \"alloc\", alloc); err != nil {\n\t\treturn err\n\t}\n\tif err := dispatch(baseDir, ctx.String(OutputResultFlag.Name), \"result\", result); err != nil {\n\t\treturn err\n\t}\n\tif err := dispatch(baseDir, ctx.String(OutputBodyFlag.Name), \"body\", body); err != nil {\n\t\treturn err\n\t}\n\tif len(stdOutObject) \u003e 0 {\n\t\tb, err := json.MarshalIndent(stdOutObject, \"\", \" \")\n\t\tif err != nil {\n\t\t\treturn NewError(ErrorJson, fmt.Errorf(\"failed marshalling output: %v\", err))\n\t\t}\n\t\tos.Stdout.Write(b)\n\t}\n\tif len(stdErrObject) \u003e 0 {\n\t\tb, err := json.MarshalIndent(stdErrObject, \"\", \" \")\n\t\tif err != nil {\n\t\t\treturn NewError(ErrorJson, fmt.Errorf(\"failed marshalling output: %v\", err))\n\t\t}\n\t\tos.Stderr.Write(b)\n\t}\n\treturn nil\n}\n\nfunc NewHeader(env stEnv) *types.Header {\n\tvar header types.Header\n\theader.Coinbase = env.Coinbase\n\theader.Difficulty = env.Difficulty\n\theader.GasLimit = env.GasLimit\n\theader.Number = new(big.Int).SetUint64(env.Number)\n\theader.Time = env.Timestamp\n\theader.BaseFee = env.BaseFee\n\theader.MixDigest = env.MixDigest\n\n\theader.UncleHash = env.UncleHash\n\theader.WithdrawalsHash = env.WithdrawalsHash\n\theader.RequestsHash = env.RequestsHash\n\n\treturn \u0026header\n}\n\nfunc CalculateStateRoot(tx kv.TemporalRwTx, blockNum uint64, txNum uint64) (*common.Hash, error) {\n\t// Generate hashed state\n\tc, err := tx.RwCursor(kv.PlainState)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\th := common.NewHasher()\n\tdefer common.ReturnHasherToPool(h)\n\tdomains, err := dbstate.NewSharedDomains(tx, log.New())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"NewSharedDomains: %w\", err)\n\t}\n\tdefer domains.Close()\n\n\tfor k, v, err := c.First(); k != nil; k, v, err = c.Next() {\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"interate over plain state: %w\", err)\n\t\t}\n\t\tvar newK []byte\n\t\tif len(k) == length.Addr {\n\t\t\tnewK = make([]byte, length.Hash)\n\t\t} else {\n\t\t\tnewK = make([]byte, length.Hash*2+length.Incarnation)\n\t\t}\n\t\th.Sha.Reset()\n\t\t//nolint:errcheck\n\t\th.Sha.Write(k[:length.Addr])\n\t\t//nolint:errcheck\n\t\th.Sha.Read(newK[:length.Hash])\n\t\tif len(k) \u003e length.Addr {\n\t\t\tcopy(newK[length.Hash:], k[length.Addr:length.Addr+length.Incarnation])\n\t\t\th.Sha.Reset()\n\t\t\t//nolint:errcheck\n\t\t\th.Sha.Write(k[length.Addr+length.Incarnation:])\n\t\t\t//nolint:errcheck\n\t\t\th.Sha.Read(newK[length.Hash+length.Incarnation:])\n\t\t\tif err = tx.Put(kv.HashedStorageDeprecated, newK, common.CopyBytes(v)); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"insert hashed key: %w\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err = tx.Put(kv.HashedAccountsDeprecated, newK, common.CopyBytes(v)); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"insert hashed key: %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\tc.Close()\n\troot, err := domains.ComputeCommitment(context.Background(), tx, true, blockNum, txNum, \"\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thashRoot := common.Hash{}\n\thashRoot.SetBytes(root)\n\n\treturn \u0026hashRoot, nil\n}\n"},"lineMatches":[{"preview":"func Main(ctx *cli.Context) error {","lineNumber":101,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/cilium/hubble"},"file":{"path":"vendor/github.com/google/gnostic-models/extensions/extensions.go","url":"/github.com/cilium/hubble/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go","content":"// Copyright 2017 Google LLC. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gnostic_extension_v1\n\nimport (\n\t\"io/ioutil\"\n\t\"log\"\n\t\"os\"\n\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/types/known/anypb\"\n)\n\ntype extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\n\n// Main implements the main program of an extension handler.\nfunc Main(handler extensionHandler) {\n\t// unpack the request\n\tdata, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tlog.Println(\"File error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tif len(data) == 0 {\n\t\tlog.Println(\"No input data.\")\n\t\tos.Exit(1)\n\t}\n\trequest := \u0026ExtensionHandlerRequest{}\n\terr = proto.Unmarshal(data, request)\n\tif err != nil {\n\t\tlog.Println(\"Input error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\t// call the handler\n\thandled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml)\n\t// respond with the output of the handler\n\tresponse := \u0026ExtensionHandlerResponse{\n\t\tHandled: false, // default assumption\n\t\tErrors: make([]string, 0),\n\t}\n\tif err != nil {\n\t\tresponse.Errors = append(response.Errors, err.Error())\n\t} else if handled {\n\t\tresponse.Handled = true\n\t\tresponse.Value, err = anypb.New(output)\n\t\tif err != nil {\n\t\t\tresponse.Errors = append(response.Errors, err.Error())\n\t\t}\n\t}\n\tresponseBytes, _ := proto.Marshal(response)\n\tos.Stdout.Write(responseBytes)\n}\n"},"lineMatches":[{"preview":"func Main(handler extensionHandler) {","lineNumber":28,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/eclipse-che/che-operator"},"file":{"path":"vendor/github.com/google/gnostic-models/extensions/extensions.go","url":"/github.com/eclipse-che/che-operator/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go","content":"// Copyright 2017 Google LLC. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gnostic_extension_v1\n\nimport (\n\t\"io/ioutil\"\n\t\"log\"\n\t\"os\"\n\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/types/known/anypb\"\n)\n\ntype extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\n\n// Main implements the main program of an extension handler.\nfunc Main(handler extensionHandler) {\n\t// unpack the request\n\tdata, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tlog.Println(\"File error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tif len(data) == 0 {\n\t\tlog.Println(\"No input data.\")\n\t\tos.Exit(1)\n\t}\n\trequest := \u0026ExtensionHandlerRequest{}\n\terr = proto.Unmarshal(data, request)\n\tif err != nil {\n\t\tlog.Println(\"Input error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\t// call the handler\n\thandled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml)\n\t// respond with the output of the handler\n\tresponse := \u0026ExtensionHandlerResponse{\n\t\tHandled: false, // default assumption\n\t\tErrors: make([]string, 0),\n\t}\n\tif err != nil {\n\t\tresponse.Errors = append(response.Errors, err.Error())\n\t} else if handled {\n\t\tresponse.Handled = true\n\t\tresponse.Value, err = anypb.New(output)\n\t\tif err != nil {\n\t\t\tresponse.Errors = append(response.Errors, err.Error())\n\t\t}\n\t}\n\tresponseBytes, _ := proto.Marshal(response)\n\tos.Stdout.Write(responseBytes)\n}\n"},"lineMatches":[{"preview":"func Main(handler extensionHandler) {","lineNumber":28,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/wader/fq"},"file":{"path":"pkg/cli/cli.go","url":"/github.com/wader/fq/-/blob/pkg/cli/cli.go","content":"package cli\n\nimport (\n\t\"bufio\"\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/fs\"\n\t\"log\"\n\t\"os\"\n\t\"os/signal\"\n\t\"path/filepath\"\n\t\"runtime\"\n\n\t\"github.com/wader/fq/pkg/interp\"\n\t\"golang.org/x/term\"\n\n\t\"github.com/ergochat/readline\"\n)\n\nfunc maybeLogFile() {\n\t// used during dev to redirect log to file, useful when debugging repl etc\n\tif lf := os.Getenv(\"LOGFILE\"); lf != \"\" {\n\t\tif f, err := os.Create(lf); err == nil {\n\t\t\tlog.SetOutput(f)\n\t\t}\n\t}\n}\n\n// function implementing readline.AutoComplete interface\ntype autoCompleterFn func(line []rune, pos int) (newLine [][]rune, length int)\n\nfunc (a autoCompleterFn) Do(line []rune, pos int) (newLine [][]rune, length int) {\n\treturn a(line, pos)\n}\n\ntype stdOS struct {\n\trl *readline.Instance\n\thistoryFile string\n\tcloseChan chan struct{}\n\tinterruptChan chan struct{}\n\tcompleterFn interp.CompleteFn\n}\n\nfunc newStandardOS() *stdOS {\n\tcloseChan := make(chan struct{})\n\tinterruptChan := make(chan struct{}, 1)\n\n\t// this more or less converts a os signal chan to just a struct{} chan that\n\t// ignores signals if forwarding it would block, also this makes sure interp\n\t// does not know about os.\n\tgo func() {\n\t\tinterruptSignalChan := make(chan os.Signal, 1)\n\t\tsignal.Notify(interruptSignalChan, os.Interrupt)\n\t\tdefer func() {\n\t\t\tsignal.Stop(interruptSignalChan)\n\t\t\tclose(interruptSignalChan)\n\t\t\tclose(interruptChan)\n\t\t}()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase \u003c-interruptSignalChan:\n\t\t\t\t// ignore if interruptChan is full\n\t\t\t\tselect {\n\t\t\t\tcase interruptChan \u003c- struct{}{}:\n\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\tcase \u003c-closeChan:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn \u0026stdOS{\n\t\tcloseChan: closeChan,\n\t\tinterruptChan: interruptChan,\n\t}\n}\n\nfunc (stdOS) Platform() interp.Platform {\n\treturn interp.Platform{\n\t\tOS: runtime.GOOS,\n\t\tArch: runtime.GOARCH,\n\t\tGoVersion: runtime.Version(),\n\t}\n}\n\ntype fdTerminal uintptr\n\nfunc (fd fdTerminal) Size() (int, int) {\n\tw, h, _ := term.GetSize(int(fd))\n\t// TODO: old version return 0 on no terminal\n\tw, h = max(0, w), max(0, h)\n\treturn w, h\n}\nfunc (fd fdTerminal) IsTerminal() bool {\n\treturn term.IsTerminal(int(fd))\n}\n\ntype stdinInput struct {\n\tfdTerminal\n\tfs.File\n}\n\nfunc (o *stdOS) Stdin() interp.Input {\n\treturn stdinInput{\n\t\tfdTerminal: fdTerminal(os.Stdin.Fd()),\n\t\tFile: interp.FileReader{\n\t\t\tR: os.Stdin,\n\t\t\tFileInfo: interp.FixedFileInfo{\n\t\t\t\tFName: \"stdin\",\n\t\t\t\tFMode: fs.ModeIrregular,\n\t\t\t},\n\t\t},\n\t}\n}\n\ntype stdoutOutput struct {\n\tfdTerminal\n\tos *stdOS\n}\n\nfunc (o stdoutOutput) Write(p []byte) (n int, err error) {\n\t// Let write go thru readline if it has been used. This to have ansi color emulation\n\t// on windows thru readlins:s stdout rewriter\n\t// TODO: check if tty instead? else only color when repl\n\tif o.os.rl != nil {\n\t\treturn o.os.rl.Write(p)\n\t}\n\treturn os.Stdout.Write(p)\n}\n\nfunc (o *stdOS) Stdout() interp.Output {\n\treturn stdoutOutput{fdTerminal: fdTerminal(os.Stdout.Fd()), os: o}\n}\n\ntype stderrOutput struct {\n\tfdTerminal\n}\n\nfunc (o stderrOutput) Write(p []byte) (n int, err error) { return os.Stderr.Write(p) }\n\nfunc (o *stdOS) Stderr() interp.Output { return stderrOutput{fdTerminal: fdTerminal(os.Stderr.Fd())} }\n\nfunc (o *stdOS) InterruptChan() chan struct{} { return o.interruptChan }\n\nfunc (*stdOS) Args() []string { return os.Args }\n\nfunc (*stdOS) Environ() []string { return os.Environ() }\n\nfunc (*stdOS) ConfigDir() (string, error) {\n\tconfigDir, err := os.UserConfigDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfqDir := filepath.Join(configDir, \"fq\")\n\n\tif runtime.GOOS != \"darwin\" {\n\t\treturn fqDir, nil\n\t}\n\n\t// this is to support fallback to ~/.config on macOS/darwin\n\tif _, err := os.Stat(fqDir); err == nil {\n\t\treturn fqDir, nil\n\t}\n\n\thomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filepath.Join(homeDir, \".config\", \"fq\"), nil\n}\n\ntype stdOSFS struct{}\n\nfunc (stdOSFS) Open(name string) (fs.File, error) { return os.Open(name) }\n\nfunc (*stdOS) FS() fs.FS { return stdOSFS{} }\n\nfunc (o *stdOS) Readline(opts interp.ReadlineOpts) (string, error) {\n\tif o.rl == nil {\n\t\tvar err error\n\n\t\tvar historyFile string\n\t\tcacheDir, err := os.UserCacheDir()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\thistoryFile = filepath.Join(cacheDir, \"fq/history\")\n\t\t_ = os.MkdirAll(filepath.Dir(historyFile), 0700)\n\n\t\tcfg := \u0026readline.Config{\n\t\t\tHistoryFile: historyFile,\n\t\t\tHistorySearchFold: true,\n\t\t\tUndo: true,\n\t\t}\n\t\tcfg.AutoComplete = autoCompleterFn(func(line []rune, pos int) (newLine [][]rune, length int) {\n\t\t\tif o.completerFn == nil {\n\t\t\t\treturn nil, 0\n\t\t\t}\n\n\t\t\tnames, shared := o.completerFn(string(line), pos)\n\t\t\tvar runeNames [][]rune\n\t\t\tfor _, name := range names {\n\t\t\t\truneNames = append(runeNames, []rune(name[shared:]))\n\t\t\t}\n\n\t\t\treturn runeNames, shared\n\t\t})\n\t\to.rl, err = readline.NewEx(cfg)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\to.historyFile = historyFile\n\t}\n\n\t// inject completer to autocompleter\n\to.completerFn = opts.CompleteFn\n\n\to.rl.SetPrompt(opts.Prompt)\n\tline, err := o.rl.Readline()\n\tif errors.Is(err, readline.ErrInterrupt) {\n\t\treturn \"\", interp.ErrInterrupt\n\t} else if errors.Is(err, io.EOF) {\n\t\treturn \"\", interp.ErrEOF\n\t} else if err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn line, nil\n}\n\nfunc (o *stdOS) History() ([]string, error) {\n\t// TODO: refactor history handling to use internal fs?\n\tr, err := os.Open(o.historyFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer r.Close()\n\tvar hs []string\n\tlineScanner := bufio.NewScanner(r)\n\tfor lineScanner.Scan() {\n\t\ths = append(hs, lineScanner.Text())\n\t}\n\tif err := lineScanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn hs, nil\n}\n\nfunc (o *stdOS) Close() error {\n\t// only close if is terminal otherwise ansi reset will write\n\t// to stdout and mess up raw output\n\tif o.rl != nil {\n\t\to.rl.Close()\n\t}\n\tclose(o.closeChan)\n\treturn nil\n}\n\nfunc Main(r *interp.Registry, version string) {\n\tos.Exit(func() int {\n\t\tdefer maybeProfile()()\n\t\tmaybeLogFile()\n\n\t\tsos := newStandardOS()\n\t\tdefer sos.Close()\n\t\ti, err := interp.New(sos, r)\n\t\tdefer i.Stop()\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(sos.Stderr(), err)\n\t\t\treturn 1\n\t\t}\n\n\t\tif err := i.Main(context.Background(), sos.Stdout(), version); err != nil {\n\t\t\tif ex, ok := err.(interp.Exiter); ok {\n\t\t\t\treturn ex.ExitCode()\n\t\t\t}\n\t\t\treturn 1\n\t\t}\n\n\t\treturn 0\n\t}())\n}\n"},"lineMatches":[{"preview":"func Main(r *interp.Registry, version string) {","lineNumber":263,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/gardener/etcd-backup-restore"},"file":{"path":"vendor/github.com/google/gnostic-models/extensions/extensions.go","url":"/github.com/gardener/etcd-backup-restore/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go","content":"// Copyright 2017 Google LLC. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gnostic_extension_v1\n\nimport (\n\t\"io/ioutil\"\n\t\"log\"\n\t\"os\"\n\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/types/known/anypb\"\n)\n\ntype extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\n\n// Main implements the main program of an extension handler.\nfunc Main(handler extensionHandler) {\n\t// unpack the request\n\tdata, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tlog.Println(\"File error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tif len(data) == 0 {\n\t\tlog.Println(\"No input data.\")\n\t\tos.Exit(1)\n\t}\n\trequest := \u0026ExtensionHandlerRequest{}\n\terr = proto.Unmarshal(data, request)\n\tif err != nil {\n\t\tlog.Println(\"Input error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\t// call the handler\n\thandled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml)\n\t// respond with the output of the handler\n\tresponse := \u0026ExtensionHandlerResponse{\n\t\tHandled: false, // default assumption\n\t\tErrors: make([]string, 0),\n\t}\n\tif err != nil {\n\t\tresponse.Errors = append(response.Errors, err.Error())\n\t} else if handled {\n\t\tresponse.Handled = true\n\t\tresponse.Value, err = anypb.New(output)\n\t\tif err != nil {\n\t\t\tresponse.Errors = append(response.Errors, err.Error())\n\t\t}\n\t}\n\tresponseBytes, _ := proto.Marshal(response)\n\tos.Stdout.Write(responseBytes)\n}\n"},"lineMatches":[{"preview":"func Main(handler extensionHandler) {","lineNumber":28,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/driver.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package driver provides the default driver for accessing a screen.\npackage driver // import \"golang.org/x/exp/shiny/driver\"\n\n// TODO: figure out what to say about the responsibility for users of this\n// package to check any implicit dependencies'' LICENSEs. For example, the\n// driver might use third party software outside of golang.org/x, like an X11\n// or OpenGL library.\n\nimport (\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\n// Main is called by the program''s main function to run the graphical\n// application.\n//\n// It calls f on the Screen, possibly in a separate goroutine, as some OS-\n// specific libraries require being on ''the main thread''. It returns when f\n// returns.\nfunc Main(f func(screen.Screen)) {\n\tmain(f)\n}\n"},"lineMatches":[{"preview":"func Main(f func(screen.Screen)) {","lineNumber":22,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/windriver/other.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/windriver/other.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build !windows\n\npackage windriver\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/errscreen\"\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\n// Main is called by the program''s main function to run the graphical\n// application.\n//\n// It calls f on the Screen, possibly in a separate goroutine, as some OS-\n// specific libraries require being on ''the main thread''. It returns when f\n// returns.\nfunc Main(f func(screen.Screen)) {\n\tf(errscreen.Stub(fmt.Errorf(\n\t\t\"windriver: unsupported GOOS/GOARCH %s/%s\", runtime.GOOS, runtime.GOARCH)))\n}\n"},"lineMatches":[{"preview":"func Main(f func(screen.Screen)) {","lineNumber":22,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package gldriver provides an OpenGL driver for accessing a screen.\npackage gldriver // import \"golang.org/x/exp/shiny/driver/gldriver\"\n\nimport (\n\t\"encoding/binary\"\n\t\"fmt\"\n\t\"math\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/errscreen\"\n\t\"golang.org/x/exp/shiny/screen\"\n\t\"golang.org/x/image/math/f64\"\n\t\"golang.org/x/mobile/gl\"\n)\n\n// Main is called by the program''s main function to run the graphical\n// application.\n//\n// It calls f on the Screen, possibly in a separate goroutine, as some OS-\n// specific libraries require being on ''the main thread''. It returns when f\n// returns.\nfunc Main(f func(screen.Screen)) {\n\tif err := main(f); err != nil {\n\t\tf(errscreen.Stub(err))\n\t}\n}\n\nfunc mul(a, b f64.Aff3) f64.Aff3 {\n\treturn f64.Aff3{\n\t\ta[0]*b[0] + a[1]*b[3],\n\t\ta[0]*b[1] + a[1]*b[4],\n\t\ta[0]*b[2] + a[1]*b[5] + a[2],\n\n\t\ta[3]*b[0] + a[4]*b[3],\n\t\ta[3]*b[1] + a[4]*b[4],\n\t\ta[3]*b[2] + a[4]*b[5] + a[5],\n\t}\n}\n\n// writeAff3 must only be called while holding windowImpl.glctxMu.\nfunc writeAff3(glctx gl.Context, u gl.Uniform, a f64.Aff3) {\n\tvar m [9]float32\n\tm[0*3+0] = float32(a[0*3+0])\n\tm[0*3+1] = float32(a[1*3+0])\n\tm[0*3+2] = 0\n\tm[1*3+0] = float32(a[0*3+1])\n\tm[1*3+1] = float32(a[1*3+1])\n\tm[1*3+2] = 0\n\tm[2*3+0] = float32(a[0*3+2])\n\tm[2*3+1] = float32(a[1*3+2])\n\tm[2*3+2] = 1\n\tglctx.UniformMatrix3fv(u, m[:])\n}\n\n// f32Bytes returns the byte representation of float32 values in the given byte\n// order. byteOrder must be either binary.BigEndian or binary.LittleEndian.\nfunc f32Bytes(byteOrder binary.ByteOrder, values ...float32) []byte {\n\tle := false\n\tswitch byteOrder {\n\tcase binary.BigEndian:\n\tcase binary.LittleEndian:\n\t\tle = true\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid byte order %v\", byteOrder))\n\t}\n\n\tb := make([]byte, 4*len(values))\n\tfor i, v := range values {\n\t\tu := math.Float32bits(v)\n\t\tif le {\n\t\t\tb[4*i+0] = byte(u \u003e\u003e 0)\n\t\t\tb[4*i+1] = byte(u \u003e\u003e 8)\n\t\t\tb[4*i+2] = byte(u \u003e\u003e 16)\n\t\t\tb[4*i+3] = byte(u \u003e\u003e 24)\n\t\t} else {\n\t\t\tb[4*i+0] = byte(u \u003e\u003e 24)\n\t\t\tb[4*i+1] = byte(u \u003e\u003e 16)\n\t\t\tb[4*i+2] = byte(u \u003e\u003e 8)\n\t\t\tb[4*i+3] = byte(u \u003e\u003e 0)\n\t\t}\n\t}\n\treturn b\n}\n\n// compileProgram must only be called while holding windowImpl.glctxMu.\nfunc compileProgram(glctx gl.Context, vSrc, fSrc string) (gl.Program, error) {\n\tprogram := glctx.CreateProgram()\n\tif program.Value == 0 {\n\t\treturn gl.Program{}, fmt.Errorf(\"gldriver: no programs available\")\n\t}\n\n\tvertexShader, err := compileShader(glctx, gl.VERTEX_SHADER, vSrc)\n\tif err != nil {\n\t\treturn gl.Program{}, err\n\t}\n\tfragmentShader, err := compileShader(glctx, gl.FRAGMENT_SHADER, fSrc)\n\tif err != nil {\n\t\tglctx.DeleteShader(vertexShader)\n\t\treturn gl.Program{}, err\n\t}\n\n\tglctx.AttachShader(program, vertexShader)\n\tglctx.AttachShader(program, fragmentShader)\n\tglctx.LinkProgram(program)\n\n\t// Flag shaders for deletion when program is unlinked.\n\tglctx.DeleteShader(vertexShader)\n\tglctx.DeleteShader(fragmentShader)\n\n\tif glctx.GetProgrami(program, gl.LINK_STATUS) == 0 {\n\t\tdefer glctx.DeleteProgram(program)\n\t\treturn gl.Program{}, fmt.Errorf(\"gldriver: program compile: %s\", glctx.GetProgramInfoLog(program))\n\t}\n\treturn program, nil\n}\n\n// compileShader must only be called while holding windowImpl.glctxMu.\nfunc compileShader(glctx gl.Context, shaderType gl.Enum, src string) (gl.Shader, error) {\n\tshader := glctx.CreateShader(shaderType)\n\tif shader.Value == 0 {\n\t\treturn gl.Shader{}, fmt.Errorf(\"gldriver: could not create shader (type %v)\", shaderType)\n\t}\n\tglctx.ShaderSource(shader, src)\n\tglctx.CompileShader(shader)\n\tif glctx.GetShaderi(shader, gl.COMPILE_STATUS) == 0 {\n\t\tdefer glctx.DeleteShader(shader)\n\t\treturn gl.Shader{}, fmt.Errorf(\"gldriver: shader compile: %s\", glctx.GetShaderInfoLog(shader))\n\t}\n\treturn shader, nil\n}\n"},"lineMatches":[{"preview":"func Main(f func(screen.Screen)) {","lineNumber":24,"offsetAndLengths":[[0,10]]}]}]}}}}' + body: '{"data":{"search":{"results":{"matchCount":10,"limitHit":true,"resultCount":10,"approximateResultCount":"10+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/yunabe/lgo"},"file":{"path":"cmd/lgo-internal/liner/liner_test.go","url":"/github.com/yunabe/lgo/-/blob/cmd/lgo-internal/liner/liner_test.go","content":"package liner\n\nimport (\n\t\"testing\"\n)\n\nfunc TestContinueLine(t *testing.T) {\n\ttests := []struct {\n\t\tlines []string\n\t\texpect bool\n\t\tindent int\n\t}{{\n\t\tlines: []string{\"x +\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\" y +\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\" func\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"if\"},\n\t\texpect: true,\n\t}, {\n\t\t// syntax error.\n\t\tlines: []string{\"if {\"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"for {\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"for{for{for{{\"},\n\t\texpect: true,\n\t\tindent: 4,\n\t}, {\n\t\tlines: []string{\"for{for{for{{}\"},\n\t\texpect: true,\n\t\tindent: 3,\n\t}, {\n\t\tlines: []string{\"func main()\"},\n\t\t// This is false because `func f()\u003cnewline\u003e{}` is invalid in Go`\n\t\texpect: false,\n\t}, {\n\t\t// Don''t return true even if \"missing function body\" occurrs.\n\t\tlines: []string{\"func main()\", \"func main2(){}\"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"import fmt\"},\n\t\t// This must be true because `import fmt\u003cnewline\u003e\"fmt\"` is invalid.\n\t\t// TODO: Fix this\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func main(\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func main(x,\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func main(x\"},\n\t\t// Strickly speaking, this should be false if there is no possible valid statement with this.\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func (\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func (r interface{\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"/* comment \"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"`raw string\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"for {\", \"for {\"},\n\t\texpect: true,\n\t\tindent: 2,\n\t}, {\n\t\tlines: []string{\"for {\", \" \"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"for {\", \"\\t\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\t// This tests dropEmptyLine.\n\t\tlines: []string{\"for {\", \"\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"type s struct {}\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"type s struct {}\", \"\"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"type s struct {}\", \" \"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"func (s) f(){}\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func (s) f(){}\", \"\"},\n\t\texpect: false,\n\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\tvar lines []string\n\t\t\tfor _, l := range tc.lines {\n\t\t\t\tlines = append(lines, l)\n\t\t\t}\n\t\t\tcont, indent := continueLine(lines)\n\t\t\tif cont != tc.expect {\n\t\t\t\tt.Errorf(\"Expected %v but got %v for %#v\", tc.expect, cont, tc.lines)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif indent != tc.indent {\n\t\t\t\tt.Errorf(\"Expected %d but got %d for %#v\", tc.indent, indent, tc.lines)\n\t\t\t}\n\t\t})\n\t}\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/ibarryyan/golang-tips-100"},"file":{"path":"code/code_01/main_exit.go","url":"/github.com/ibarryyan/golang-tips-100/-/blob/code/code_01/main_exit.go","content":"package main\n\nfunc main() {\n\tdefer func() {for {}}()\n\t// TODO\n}\n\nfunc main() {\n\tdefer func() { select {} }()\n\t// TODO\n}\n\nfunc main() {\n\t// TODO\n\tselect {}\n}"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/unigornel/unigornel"},"file":{"path":"integration_tests/tests/console/simple/main.go","url":"/github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/simple/main.go","content":"package main\n\nimport \"C\"\nimport \"fmt\"\n\nfunc main() {}\n\n//export Main\nfunc Main(unused int) {\n\tfmt.Printf(\"Hello World!\\n\")\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/jiro4989/textimg"},"file":{"path":"main.go","url":"/github.com/jiro4989/textimg/-/blob/main.go","content":"package main\n\nimport (\n\t\"os\"\n)\n\nfunc main() {\n\tos.Exit(Main())\n}\n\nfunc Main() int {\n\tif err := RootCommand.Execute(); err != nil {\n\t\treturn -1\n\t}\n\treturn 0\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/naeemaei/Golang-Tutorial"},"file":{"path":"15-Concurrency/09-Channels/main.go","url":"/github.com/naeemaei/Golang-Tutorial/-/blob/15-Concurrency/09-Channels/main.go","content":"package main\n\nimport \"concurrency/examples\"\n\nfunc main() {\n\texamples.RunHttpExample2()\n\t//examples.RunHttpUExample2()\n}\npackage main\n\nfunc main() {\n\t\t\n}"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/unigornel/unigornel"},"file":{"path":"integration_tests/tests/console/sleep_and_time/main.go","url":"/github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/sleep_and_time/main.go","content":"package main\n\nimport \"C\"\nimport (\n\t\"fmt\"\n\t\"time\"\n)\n\nfunc main() {}\n\n//export Main\nfunc Main(unused int) {\n\tfor {\n\t\tt := time.Now()\n\t\tfmt.Printf(\"%v [%v] Hello World!\\n\", t.UnixNano(), t.UTC())\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/Avtostopom-po-Go/Avtostopom_po_Go_course"},"file":{"path":"easy level/slice.go","url":"/github.com/Avtostopom-po-Go/Avtostopom_po_Go_course/-/blob/easy%20level/slice.go","content":"package main\n\nimport \"fmt\"\n\n// 1\n// Какой будет результат выполнения приложения?\nfunc main() {\n\ta := []string{\"a\", \"b\", \"c\"}\n\tb := a[1:2]\n\tb[0] = \"q\"\n\tfmt.Println(a)\n}\n\n// 2\n// Что выведет код и почему?\nfunc mod(a []int) {\n\ta = append(a, 125)\n\tfor i := range a {\n\t\ta[i] = 5\n\t}\n\tfmt.Println(a)\n}\nfunc main() {\n\tsl := []int{1, 2, 3, 4, 5}\n\tmod(sl)\n\tfmt.Println(sl)\n}\n\n// 3\n// Что выведет код и почему?\nfunc mod(a []int) {\n\tfor i := range a {\n\t\ta[i] = 5\n\t}\n\tfmt.Println(a)\n}\nfunc main() {\n\tsl := make([]int, 4, 8)\n\tsl[0] = 1\n\tsl[1] = 2\n\tsl[2] = 3\n\tsl[3] = 5\n\tmod(sl)\n\tfmt.Println(sl)\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/unigornel/unigornel"},"file":{"path":"integration_tests/tests/console/read_from_console/main.go","url":"/github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/read_from_console/main.go","content":"package main\n\nimport \"C\"\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n)\n\nfunc main() {\n\tMain(0)\n}\n\n//export Main\nfunc Main(unused int) {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfmt.Print(\"Hello, what''s your name? \")\n\tname, _ := reader.ReadString(''\\n'')\n\tfmt.Printf(\"Hello, %s\\n\", strings.TrimSpace(name))\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/MichaelCade/90DaysOfDevOps"},"file":{"path":"2022/tr/Days/Go/hello.go","url":"/github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/tr/Days/Go/hello.go","content":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD:2022/es/Days/Go/hello.go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Until tomorrow #90DaysOfDevOps\")\n}\n=======\npackage main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n\tfmt.Println(\"Hasta mañana #90DaysOfDevOps\")\r\n}\r\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e feature/translateES-03-adaptation:es/Days/Go/hello.go\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/MichaelCade/90DaysOfDevOps"},"file":{"path":"2022/es/Days/Go/hello.go","url":"/github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/es/Days/Go/hello.go","content":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD:2022/es/Days/Go/hello.go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Until tomorrow #90DaysOfDevOps\")\n}\n=======\npackage main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n\tfmt.Println(\"Hasta mañana #90DaysOfDevOps\")\r\n}\r\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e feature/translateES-03-adaptation:es/Days/Go/hello.go\n"},"lineMatches":[]}]}}}}' headers: Content-Type: - application/json status: 200 OK code: 200 - duration: 1.468141667s + duration: 1.5393335s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 39406 + content_length: 36431 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_eG1GRwBeCLOUWghVcDdwhumF\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"lang:go content:\\\\\\\"func main(\\\\\\\" type:file count:10\\\",\\\"count\\\":10,\\\"timeout\\\":60}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 10 matches across 10 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/yinchengtsinghua/go-ethereum-chinese/cmd/wnode/main.go\\n\\nURL: /github.com/yinchengtsinghua/go-ethereum-chinese/-/blob/cmd/wnode/main.go\\n\\n```\\n106| \\targServerPoW = flag.Float64(\\\"mspow\\\", whisper.DefaultMinimumPoW, \\\"PoW requirement for Mail Server request\\\")\\n107| \\n108| \\targIP = flag.String(\\\"ip\\\", \\\"\\\", \\\"IP address and port of this node (e.g. 127.0.0.1:30303)\\\")\\n109| \\targPub = flag.String(\\\"pub\\\", \\\"\\\", \\\"public key for asymmetric encryption\\\")\\n110| \\targDBPath = flag.String(\\\"dbpath\\\", \\\"\\\", \\\"path to the server's DB directory\\\")\\n111| \\targIDFile = flag.String(\\\"idfile\\\", \\\"\\\", \\\"file name with node id (private key)\\\")\\n112| argEnode = flag.String(\\\"boot\\\", \\\"\\\", \\\"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\\n113| \\targTopic = flag.String(\\\"topic\\\", \\\"\\\", \\\"topic in hexadecimal format (e.g. 70a4beef)\\\")\\n114| \\targSaveDir = flag.String(\\\"savedir\\\", \\\"\\\", \\\"directory where all incoming messages will be saved as files\\\")\\n115| )\\n116| func main() {\\n117| func main() {\\n118| \\tprocessArgs()\\n119| \\tinitialize()\\n120| \\trun()\\n121| \\tshutdown()\\n122| }\\n123| \\n124| func processArgs() {\\n125| \\tflag.Parse()\\n126| \\n```\\n\\n## Result 2: github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/cmd/wnode/main.go\\n\\nURL: /github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/-/blob/cmd/wnode/main.go\\n\\n```\\n106| \\targServerPoW = flag.Float64(\\\"mspow\\\", whisper.DefaultMinimumPoW, \\\"PoW requirement for Mail Server request\\\")\\n107| \\n108| \\targIP = flag.String(\\\"ip\\\", \\\"\\\", \\\"IP address and port of this node (e.g. 127.0.0.1:30303)\\\")\\n109| \\targPub = flag.String(\\\"pub\\\", \\\"\\\", \\\"public key for asymmetric encryption\\\")\\n110| \\targDBPath = flag.String(\\\"dbpath\\\", \\\"\\\", \\\"path to the server's DB directory\\\")\\n111| \\targIDFile = flag.String(\\\"idfile\\\", \\\"\\\", \\\"file name with node id (private key)\\\")\\n112| argEnode = flag.String(\\\"boot\\\", \\\"\\\", \\\"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\\n113| \\targTopic = flag.String(\\\"topic\\\", \\\"\\\", \\\"topic in hexadecimal format (e.g. 70a4beef)\\\")\\n114| \\targSaveDir = flag.String(\\\"savedir\\\", \\\"\\\", \\\"directory where all incoming messages will be saved as files\\\")\\n115| )\\n116| func main() {\\n117| func main() {\\n118| \\tprocessArgs()\\n119| \\tinitialize()\\n120| \\trun()\\n121| \\tshutdown()\\n122| }\\n123| \\n124| func processArgs() {\\n125| \\tflag.Parse()\\n126| \\n```\\n\\n## Result 3: github.com/erigontech/erigon/cmd/evm/internal/t8ntool/transition.go\\n\\nURL: /github.com/erigontech/erigon/-/blob/cmd/evm/internal/t8ntool/transition.go\\n\\n```\\n91| // compile-time conformance test\\n92| var (\\n93| \\t_ cli.ExitCoder = (*NumberedError)(nil)\\n94| )\\n95| \\n96| type input struct {\\n97| \\tAlloc types.GenesisAlloc `json:\\\"alloc,omitempty\\\"`\\n98| \\tEnv *stEnv `json:\\\"env,omitempty\\\"`\\n99| \\tTxs []*txWithKey `json:\\\"txs,omitempty\\\"`\\n100| }\\n101| func Main(ctx *cli.Context) error {\\n102| func Main(ctx *cli.Context) error {\\n103| \\tlog.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StderrHandler))\\n104| \\tvar (\\n105| \\t\\terr error\\n106| \\t\\tbaseDir = \\\"\\\"\\n107| \\t)\\n108| \\tvar getTracer func(txIndex int, txHash common.Hash) (*tracing.Hooks, error)\\n109| \\n110| \\t// If user specified a basedir, make sure it exists\\n111| \\tif ctx.IsSet(OutputBasedir.Name) {\\n```\\n\\n## Result 4: github.com/cilium/hubble/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\nURL: /github.com/cilium/hubble/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\n```\\n18| \\t\\\"io/ioutil\\\"\\n19| \\t\\\"log\\\"\\n20| \\t\\\"os\\\"\\n21| \\n22| \\t\\\"google.golang.org/protobuf/proto\\\"\\n23| \\t\\\"google.golang.org/protobuf/types/known/anypb\\\"\\n24| )\\n25| \\n26| type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\\n27| \\n28| func Main(handler extensionHandler) {\\n29| func Main(handler extensionHandler) {\\n30| \\t// unpack the request\\n31| \\tdata, err := ioutil.ReadAll(os.Stdin)\\n32| \\tif err != nil {\\n33| \\t\\tlog.Println(\\\"File error:\\\", err.Error())\\n34| \\t\\tos.Exit(1)\\n35| \\t}\\n36| \\tif len(data) == 0 {\\n37| \\t\\tlog.Println(\\\"No input data.\\\")\\n38| \\t\\tos.Exit(1)\\n```\\n\\n## Result 5: github.com/eclipse-che/che-operator/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\nURL: /github.com/eclipse-che/che-operator/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\n```\\n18| \\t\\\"io/ioutil\\\"\\n19| \\t\\\"log\\\"\\n20| \\t\\\"os\\\"\\n21| \\n22| \\t\\\"google.golang.org/protobuf/proto\\\"\\n23| \\t\\\"google.golang.org/protobuf/types/known/anypb\\\"\\n24| )\\n25| \\n26| type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\\n27| \\n28| func Main(handler extensionHandler) {\\n29| func Main(handler extensionHandler) {\\n30| \\t// unpack the request\\n31| \\tdata, err := ioutil.ReadAll(os.Stdin)\\n32| \\tif err != nil {\\n33| \\t\\tlog.Println(\\\"File error:\\\", err.Error())\\n34| \\t\\tos.Exit(1)\\n35| \\t}\\n36| \\tif len(data) == 0 {\\n37| \\t\\tlog.Println(\\\"No input data.\\\")\\n38| \\t\\tos.Exit(1)\\n```\\n\\n## Result 6: github.com/wader/fq/pkg/cli/cli.go\\n\\nURL: /github.com/wader/fq/-/blob/pkg/cli/cli.go\\n\\n```\\n253| \\n254| func (o *stdOS) Close() error {\\n255| \\t// only close if is terminal otherwise ansi reset will write\\n256| \\t// to stdout and mess up raw output\\n257| \\tif o.rl != nil {\\n258| \\t\\to.rl.Close()\\n259| \\t}\\n260| \\tclose(o.closeChan)\\n261| \\treturn nil\\n262| }\\n263| func Main(r *interp.Registry, version string) {\\n264| func Main(r *interp.Registry, version string) {\\n265| \\tos.Exit(func() int {\\n266| \\t\\tdefer maybeProfile()()\\n267| \\t\\tmaybeLogFile()\\n268| \\n269| \\t\\tsos := newStandardOS()\\n270| \\t\\tdefer sos.Close()\\n271| \\t\\ti, err := interp.New(sos, r)\\n272| \\t\\tdefer i.Stop()\\n273| \\t\\tif err != nil {\\n```\\n\\n## Result 7: github.com/gardener/etcd-backup-restore/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\nURL: /github.com/gardener/etcd-backup-restore/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\n```\\n18| \\t\\\"io/ioutil\\\"\\n19| \\t\\\"log\\\"\\n20| \\t\\\"os\\\"\\n21| \\n22| \\t\\\"google.golang.org/protobuf/proto\\\"\\n23| \\t\\\"google.golang.org/protobuf/types/known/anypb\\\"\\n24| )\\n25| \\n26| type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\\n27| \\n28| func Main(handler extensionHandler) {\\n29| func Main(handler extensionHandler) {\\n30| \\t// unpack the request\\n31| \\tdata, err := ioutil.ReadAll(os.Stdin)\\n32| \\tif err != nil {\\n33| \\t\\tlog.Println(\\\"File error:\\\", err.Error())\\n34| \\t\\tos.Exit(1)\\n35| \\t}\\n36| \\tif len(data) == 0 {\\n37| \\t\\tlog.Println(\\\"No input data.\\\")\\n38| \\t\\tos.Exit(1)\\n```\\n\\n## Result 8: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/driver.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver.go\\n\\n```\\n12| \\n13| import (\\n14| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n15| )\\n16| \\n17| // Main is called by the program's main function to run the graphical\\n18| // application.\\n19| //\\n20| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n21| // specific libraries require being on 'the main thread'. It returns when f\\n22| func Main(f func(screen.Screen)) {\\n23| func Main(f func(screen.Screen)) {\\n24| \\tmain(f)\\n25| }\\n26| \\n```\\n\\n## Result 9: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/windriver/other.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/windriver/other.go\\n\\n```\\n12| \\n13| \\t\\\"golang.org/x/exp/shiny/driver/internal/errscreen\\\"\\n14| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n15| )\\n16| \\n17| // Main is called by the program's main function to run the graphical\\n18| // application.\\n19| //\\n20| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n21| // specific libraries require being on 'the main thread'. It returns when f\\n22| func Main(f func(screen.Screen)) {\\n23| func Main(f func(screen.Screen)) {\\n24| \\tf(errscreen.Stub(fmt.Errorf(\\n25| \\t\\t\\\"windriver: unsupported GOOS/GOARCH %s/%s\\\", runtime.GOOS, runtime.GOARCH)))\\n26| }\\n27| \\n```\\n\\n## Result 10: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go\\n\\n```\\n14| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n15| \\t\\\"golang.org/x/image/math/f64\\\"\\n16| \\t\\\"golang.org/x/mobile/gl\\\"\\n17| )\\n18| \\n19| // Main is called by the program's main function to run the graphical\\n20| // application.\\n21| //\\n22| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n23| // specific libraries require being on 'the main thread'. It returns when f\\n24| func Main(f func(screen.Screen)) {\\n25| func Main(f func(screen.Screen)) {\\n26| \\tif err := main(f); err != nil {\\n27| \\t\\tf(errscreen.Stub(err))\\n28| \\t}\\n29| }\\n30| \\n31| func mul(a, b f64.Aff3) f64.Aff3 {\\n32| \\treturn f64.Aff3{\\n33| \\t\\ta[0]*b[0] + a[1]*b[3],\\n34| \\t\\ta[0]*b[1] + a[1]*b[4],\\n```\\n\\n\",\"tool_call_id\":\"call_eG1GRwBeCLOUWghVcDdwhumF\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_V0HcojYtDXno6EPtEMUvUMWX\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"lang:go \\\\\\\"func main(\\\\\\\" select:file count:10\\\",\\\"count\\\":10}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 10 matches across 10 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/yunabe/lgo/cmd/lgo-internal/liner/liner_test.go\\n\\nURL: /github.com/yunabe/lgo/-/blob/cmd/lgo-internal/liner/liner_test.go\\n\\n## Result 2: github.com/ibarryyan/golang-tips-100/code/code_01/main_exit.go\\n\\nURL: /github.com/ibarryyan/golang-tips-100/-/blob/code/code_01/main_exit.go\\n\\n## Result 3: github.com/unigornel/unigornel/integration_tests/tests/console/simple/main.go\\n\\nURL: /github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/simple/main.go\\n\\n## Result 4: github.com/jiro4989/textimg/main.go\\n\\nURL: /github.com/jiro4989/textimg/-/blob/main.go\\n\\n## Result 5: github.com/naeemaei/Golang-Tutorial/15-Concurrency/09-Channels/main.go\\n\\nURL: /github.com/naeemaei/Golang-Tutorial/-/blob/15-Concurrency/09-Channels/main.go\\n\\n## Result 6: github.com/unigornel/unigornel/integration_tests/tests/console/sleep_and_time/main.go\\n\\nURL: /github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/sleep_and_time/main.go\\n\\n## Result 7: github.com/Avtostopom-po-Go/Avtostopom_po_Go_course/easy level/slice.go\\n\\nURL: /github.com/Avtostopom-po-Go/Avtostopom_po_Go_course/-/blob/easy%20level/slice.go\\n\\n## Result 8: github.com/unigornel/unigornel/integration_tests/tests/console/read_from_console/main.go\\n\\nURL: /github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/read_from_console/main.go\\n\\n## Result 9: github.com/MichaelCade/90DaysOfDevOps/2022/tr/Days/Go/hello.go\\n\\nURL: /github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/tr/Days/Go/hello.go\\n\\n## Result 10: github.com/MichaelCade/90DaysOfDevOps/2022/es/Days/Go/hello.go\\n\\nURL: /github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/es/Days/Go/hello.go\\n\\n\",\"tool_call_id\":\"call_V0HcojYtDXno6EPtEMUvUMWX\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -200,182 +190,177 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_zCYl929MzrVvYZ0oepRDlj2S","type":"function","function":{"name":"sourcegraph","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"nsxID"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"0Z0dhIbPra"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"oFOD6roIsF2HgvC"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Found"},"finish_reason":null}],"usage":null,"obfuscation":"8ECy0YD"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"query"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zhPUtIQSVYr2h"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"XCQUFzM2Hdd"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"xUAj0KA0hQXkc"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"10"},"finish_reason":null}],"usage":null,"obfuscation":"CbdcD52s44"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"lang"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5uH8RDQnIbY27i"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" results"},"finish_reason":null}],"usage":null,"obfuscation":"Hqal"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".\n"},"finish_reason":null}],"usage":null,"obfuscation":"L6Nm0CLyJ"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Examples"},"finish_reason":null}],"usage":null,"obfuscation":"6ub0"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" case"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Na8zglqyVQOC5"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"AvuPYP5ZnT9"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"v9UZ9"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"yes"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jHCGS8ZCgFhcN0w"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"B4KTqgAr"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c50QwVTgap"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"4jYc47d1Iam"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"KrvCZfXJtXp4y"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ib"},"finish_reason":null}],"usage":null,"obfuscation":"FJQ4AMmCj8"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UbrFL6LDMr6s4n"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"arry"},"finish_reason":null}],"usage":null,"obfuscation":"mPjNELpa"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wEHBORSzpb56n"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"yan"},"finish_reason":null}],"usage":null,"obfuscation":"3fgIbFFm6"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"PrLoIc5Bjblb9"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/g"},"finish_reason":null}],"usage":null,"obfuscation":"ABhUSQWjf4"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" type"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4nDFWl8N1kcy3"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"olang"},"finish_reason":null}],"usage":null,"obfuscation":"ILacjkO"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VqCFj770NvTcR"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-t"},"finish_reason":null}],"usage":null,"obfuscation":"c0NukKkXKD"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5lFN0wQOQ0N9"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ips"},"finish_reason":null}],"usage":null,"obfuscation":"VmYaImzw5"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"S"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"CUC9AYXAwqr"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"100"},"finish_reason":null}],"usage":null,"obfuscation":"kyZfGNBYq"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"VKCGJxMSybXNn"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/code"},"finish_reason":null}],"usage":null,"obfuscation":"4H0YUdC"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oR1v9a6eS9s3R"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/code"},"finish_reason":null}],"usage":null,"obfuscation":"BNRkePM"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AI2aUJzSU6wigJw"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_"},"finish_reason":null}],"usage":null,"obfuscation":"cIp07MoHOLD"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"01"},"finish_reason":null}],"usage":null,"obfuscation":"PdhhuX8ppA"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"j1oxBVTHSXwwm6K"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"37XPEcX"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EuGdXE1LIct"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_exit"},"finish_reason":null}],"usage":null,"obfuscation":"gKVq92m"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WzDqg28ifVHiz93"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"5T8RG0eCT"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"60"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":";"},"finish_reason":null}],"usage":null,"obfuscation":"vhwxvmGNNkD"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"qmxio"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"Z3Xw70Wl"} - data: {"id":"chatcmpl-CTnvjUPXNibJ315mMuq4UvyF4QCYK","object":"chat.completion.chunk","created":1761219479,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9260,"completion_tokens":302,"total_tokens":9562,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"z"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"lQ7FJHf98DN"} - data: [DONE] + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ji"},"finish_reason":null}],"usage":null,"obfuscation":"abHYcU4WNE"} - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 7.457081916s -- id: 4 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 465 - 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 case:yes content:\"func main(\" type:file count:10"}}' - 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":10,"limitHit":true,"resultCount":10,"approximateResultCount":"10+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/yinchengtsinghua/go-ethereum-chinese"},"file":{"path":"cmd/wnode/main.go","url":"/github.com/yinchengtsinghua/go-ethereum-chinese/-/blob/cmd/wnode/main.go","content":"\n//此源码被清华学神尹成大魔王专业翻译分析并修改\n//尹成QQ77025077\n//尹成微信18510341407\n//尹成所在QQ群721929980\n//尹成邮箱 yinc13@mails.tsinghua.edu.cn\n//尹成毕业于清华大学,微软区块链领域全球最有价值专家\n//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620\n//版权所有2017 Go Ethereum作者\n//此文件是Go以太坊的一部分。\n//\n//Go以太坊是免费软件:您可以重新发布和/或修改它\n//根据GNU通用公共许可证的条款\n//自由软件基金会,或者许可证的第3版,或者\n//(由您选择)任何更高版本。\n//\n//Go以太坊的分布希望它会有用,\n//但没有任何保证;甚至没有\n//适销性或特定用途的适用性。见\n//GNU通用公共许可证了解更多详细信息。\n//\n//你应该已经收到一份GNU通用公共许可证的副本\n//一起去以太坊吧。如果没有,请参见\u003chttp://www.gnu.org/licenses/\u003e。\n\n//这是一个简单的耳语节点。它可以用作独立的引导节点。\n//也可用于不同的测试和诊断目的。\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"crypto/ecdsa\"\n\tcrand \"crypto/rand\"\n\t\"crypto/sha512\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"flag\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/ethereum/go-ethereum/cmd/utils\"\n\t\"github.com/ethereum/go-ethereum/common\"\n\t\"github.com/ethereum/go-ethereum/console\"\n\t\"github.com/ethereum/go-ethereum/crypto\"\n\t\"github.com/ethereum/go-ethereum/log\"\n\t\"github.com/ethereum/go-ethereum/p2p\"\n\t\"github.com/ethereum/go-ethereum/p2p/enode\"\n\t\"github.com/ethereum/go-ethereum/p2p/nat\"\n\t\"github.com/ethereum/go-ethereum/whisper/mailserver\"\n\twhisper \"github.com/ethereum/go-ethereum/whisper/whisperv6\"\n\t\"golang.org/x/crypto/pbkdf2\"\n)\n\nconst quitCommand = \"~Q\"\nconst entropySize = 32\n\n//独生子女\nvar (\n\tserver *p2p.Server\n\tshh *whisper.Whisper\n\tdone chan struct{}\n\tmailServer mailserver.WMailServer\n\tentropy [entropySize]byte\n\n\tinput = bufio.NewReader(os.Stdin)\n)\n\n//加密\nvar (\n\tsymKey []byte\n\tpub *ecdsa.PublicKey\n\tasymKey *ecdsa.PrivateKey\n\tnodeid *ecdsa.PrivateKey\n\ttopic whisper.TopicType\n\n\tasymKeyID string\n\tasymFilterID string\n\tsymFilterID string\n\tsymPass string\n\tmsPassword string\n)\n\n//CMD参数\nvar (\n\tbootstrapMode = flag.Bool(\"standalone\", false, \"boostrap node: don''t initiate connection to peers, just wait for incoming connections\")\n\tforwarderMode = flag.Bool(\"forwarder\", false, \"forwarder mode: only forward messages, neither encrypt nor decrypt messages\")\n\tmailServerMode = flag.Bool(\"mailserver\", false, \"mail server mode: delivers expired messages on demand\")\n\trequestMail = flag.Bool(\"mailclient\", false, \"request expired messages from the bootstrap server\")\n\tasymmetricMode = flag.Bool(\"asym\", false, \"use asymmetric encryption\")\n\tgenerateKey = flag.Bool(\"generatekey\", false, \"generate and show the private key\")\n\tfileExMode = flag.Bool(\"fileexchange\", false, \"file exchange mode\")\n\tfileReader = flag.Bool(\"filereader\", false, \"load and decrypt messages saved as files, display as plain text\")\n\ttestMode = flag.Bool(\"test\", false, \"use of predefined parameters for diagnostics (password, etc.)\")\n\techoMode = flag.Bool(\"echo\", false, \"echo mode: prints some arguments for diagnostics\")\n\n\targVerbosity = flag.Int(\"verbosity\", int(log.LvlError), \"log verbosity level\")\n\targTTL = flag.Uint(\"ttl\", 30, \"time-to-live for messages in seconds\")\n\targWorkTime = flag.Uint(\"work\", 5, \"work time in seconds\")\n\targMaxSize = flag.Uint(\"maxsize\", uint(whisper.DefaultMaxMessageSize), \"max size of message\")\n\targPoW = flag.Float64(\"pow\", whisper.DefaultMinimumPoW, \"PoW for normal messages in float format (e.g. 2.7)\")\n\targServerPoW = flag.Float64(\"mspow\", whisper.DefaultMinimumPoW, \"PoW requirement for Mail Server request\")\n\n\targIP = flag.String(\"ip\", \"\", \"IP address and port of this node (e.g. 127.0.0.1:30303)\")\n\targPub = flag.String(\"pub\", \"\", \"public key for asymmetric encryption\")\n\targDBPath = flag.String(\"dbpath\", \"\", \"path to the server''s DB directory\")\n\targIDFile = flag.String(\"idfile\", \"\", \"file name with node id (private key)\")\nargEnode = flag.String(\"boot\", \"\", \"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\n\targTopic = flag.String(\"topic\", \"\", \"topic in hexadecimal format (e.g. 70a4beef)\")\n\targSaveDir = flag.String(\"savedir\", \"\", \"directory where all incoming messages will be saved as files\")\n)\n\nfunc main() {\n\tprocessArgs()\n\tinitialize()\n\trun()\n\tshutdown()\n}\n\nfunc processArgs() {\n\tflag.Parse()\n\n\tif len(*argIDFile) \u003e 0 {\n\t\tvar err error\n\t\tnodeid, err = crypto.LoadECDSA(*argIDFile)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to load file [%s]: %s.\", *argIDFile, err)\n\t\t}\n\t}\n\nconst enodePrefix = \"enode://“\n\tif len(*argEnode) \u003e 0 {\n\t\tif (*argEnode)[:len(enodePrefix)] != enodePrefix {\n\t\t\t*argEnode = enodePrefix + *argEnode\n\t\t}\n\t}\n\n\tif len(*argTopic) \u003e 0 {\n\t\tx, err := hex.DecodeString(*argTopic)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to parse the topic: %s\", err)\n\t\t}\n\t\ttopic = whisper.BytesToTopic(x)\n\t}\n\n\tif *asymmetricMode \u0026\u0026 len(*argPub) \u003e 0 {\n\t\tvar err error\n\t\tif pub, err = crypto.UnmarshalPubkey(common.FromHex(*argPub)); err != nil {\n\t\t\tutils.Fatalf(\"invalid public key\")\n\t\t}\n\t}\n\n\tif len(*argSaveDir) \u003e 0 {\n\t\tif _, err := os.Stat(*argSaveDir); os.IsNotExist(err) {\n\t\t\tutils.Fatalf(\"Download directory ''%s'' does not exist\", *argSaveDir)\n\t\t}\n\t} else if *fileExMode {\n\t\tutils.Fatalf(\"Parameter ''savedir'' is mandatory for file exchange mode\")\n\t}\n\n\tif *echoMode {\n\t\techo()\n\t}\n}\n\nfunc echo() {\n\tfmt.Printf(\"ttl = %d \\n\", *argTTL)\n\tfmt.Printf(\"workTime = %d \\n\", *argWorkTime)\n\tfmt.Printf(\"pow = %f \\n\", *argPoW)\n\tfmt.Printf(\"mspow = %f \\n\", *argServerPoW)\n\tfmt.Printf(\"ip = %s \\n\", *argIP)\n\tfmt.Printf(\"pub = %s \\n\", common.ToHex(crypto.FromECDSAPub(pub)))\n\tfmt.Printf(\"idfile = %s \\n\", *argIDFile)\n\tfmt.Printf(\"dbpath = %s \\n\", *argDBPath)\n\tfmt.Printf(\"boot = %s \\n\", *argEnode)\n}\n\nfunc initialize() {\n\tlog.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*argVerbosity), log.StreamHandler(os.Stderr, log.TerminalFormat(false))))\n\n\tdone = make(chan struct{})\n\tvar peers []*enode.Node\n\tvar err error\n\n\tif *generateKey {\n\t\tkey, err := crypto.GenerateKey()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate private key: %s\", err)\n\t\t}\n\t\tk := hex.EncodeToString(crypto.FromECDSA(key))\n\t\tfmt.Printf(\"Random private key: %s \\n\", k)\n\t\tos.Exit(0)\n\t}\n\n\tif *testMode {\nsymPass = \"wwww\" //ASCII码:0x77777777\n\t\tmsPassword = \"wwww\"\n\t}\n\n\tif *bootstrapMode {\n\t\tif len(*argIP) == 0 {\n\t\t\targIP = scanLineA(\"Please enter your IP and port (e.g. 127.0.0.1:30348): \")\n\t\t}\n\t} else if *fileReader {\n\t\t*bootstrapMode = true\n\t} else {\n\t\tif len(*argEnode) == 0 {\n\t\t\targEnode = scanLineA(\"Please enter the peer''s enode: \")\n\t\t}\n\t\tpeer := enode.MustParseV4(*argEnode)\n\t\tpeers = append(peers, peer)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tcfg := \u0026whisper.Config{\n\t\tMaxMessageSize: uint32(*argMaxSize),\n\t\tMinimumAcceptedPOW: *argPoW,\n\t}\n\n\tshh = whisper.New(cfg)\n\n\tif *argPoW != whisper.DefaultMinimumPoW {\n\t\terr := shh.SetMinimumPoW(*argPoW)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set PoW: %s\", err)\n\t\t}\n\t}\n\n\tif uint32(*argMaxSize) != whisper.DefaultMaxMessageSize {\n\t\terr := shh.SetMaxMessageSize(uint32(*argMaxSize))\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set max message size: %s\", err)\n\t\t}\n\t}\n\n\tasymKeyID, err = shh.NewKeyPair()\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t}\n\n\tasymKey, err = shh.GetPrivateKey(asymKeyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t}\n\n\tif nodeid == nil {\n\t\ttmpID, err := shh.NewKeyPair()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t\t}\n\n\t\tnodeid, err = shh.GetPrivateKey(tmpID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t\t}\n\t}\n\n\tmaxPeers := 80\n\tif *bootstrapMode {\n\t\tmaxPeers = 800\n\t}\n\n\t_, err = crand.Read(entropy[:])\n\tif err != nil {\n\t\tutils.Fatalf(\"crypto/rand failed: %s\", err)\n\t}\n\n\tif *mailServerMode {\n\t\tshh.RegisterServer(\u0026mailServer)\n\t\tif err := mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW); err != nil {\n\t\t\tutils.Fatalf(\"Failed to init MailServer: %s\", err)\n\t\t}\n\t}\n\n\tserver = \u0026p2p.Server{\n\t\tConfig: p2p.Config{\n\t\t\tPrivateKey: nodeid,\n\t\t\tMaxPeers: maxPeers,\n\t\t\tName: common.MakeName(\"wnode\", \"6.0\"),\n\t\t\tProtocols: shh.Protocols(),\n\t\t\tListenAddr: *argIP,\n\t\t\tNAT: nat.Any(),\n\t\t\tBootstrapNodes: peers,\n\t\t\tStaticNodes: peers,\n\t\t\tTrustedNodes: peers,\n\t\t},\n\t}\n}\n\nfunc startServer() error {\n\terr := server.Start()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to start Whisper peer: %s.\", err)\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"my public key: %s \\n\", common.ToHex(crypto.FromECDSAPub(\u0026asymKey.PublicKey)))\n\tfmt.Println(server.NodeInfo().Enode)\n\n\tif *bootstrapMode {\n\t\tconfigureNode()\n\t\tfmt.Println(\"Bootstrap Whisper node started\")\n\t} else {\n\t\tfmt.Println(\"Whisper node started\")\n//首先看看我们是否可以建立连接,然后请求用户输入\n\t\twaitForConnection(true)\n\t\tconfigureNode()\n\t}\n\n\tif *fileExMode {\n\t\tfmt.Printf(\"Please type the file name to be send. To quit type: ''%s''\\n\", quitCommand)\n\t} else if *fileReader {\n\t\tfmt.Printf(\"Please type the file name to be decrypted. To quit type: ''%s''\\n\", quitCommand)\n\t} else if !*forwarderMode {\n\t\tfmt.Printf(\"Please type the message. To quit type: ''%s''\\n\", quitCommand)\n\t}\n\treturn nil\n}\n\nfunc configureNode() {\n\tvar err error\n\tvar p2pAccept bool\n\n\tif *forwarderMode {\n\t\treturn\n\t}\n\n\tif *asymmetricMode {\n\t\tif len(*argPub) == 0 {\n\t\t\ts := scanLine(\"Please enter the peer''s public key: \")\n\t\t\tb := common.FromHex(s)\n\t\t\tif b == nil {\n\t\t\t\tutils.Fatalf(\"Error: can not convert hexadecimal string\")\n\t\t\t}\n\t\t\tif pub, err = crypto.UnmarshalPubkey(b); err != nil {\n\t\t\t\tutils.Fatalf(\"Error: invalid peer public key\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif *requestMail {\n\t\tp2pAccept = true\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !*asymmetricMode \u0026\u0026 !*forwarderMode {\n\t\tif len(symPass) == 0 {\n\t\t\tsymPass, err = console.Stdin.PromptPassword(\"Please enter the password for symmetric encryption: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read passphrase: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tsymKeyID, err := shh.AddSymKeyFromPassword(symPass)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to create symmetric key: %s\", err)\n\t\t}\n\t\tsymKey, err = shh.GetSymKey(symKeyID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to save symmetric key: %s\", err)\n\t\t}\n\t\tif len(*argTopic) == 0 {\n\t\t\tgenerateTopic([]byte(symPass))\n\t\t}\n\n\t\tfmt.Printf(\"Filter is configured for the topic: %x \\n\", topic)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(*argDBPath) == 0 {\n\t\t\targDBPath = scanLineA(\"Please enter the path to DB file: \")\n\t\t}\n\t}\n\n\tsymFilter := whisper.Filter{\n\t\tKeySym: symKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tsymFilterID, err = shh.Subscribe(\u0026symFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n\n\tasymFilter := whisper.Filter{\n\t\tKeyAsym: asymKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tasymFilterID, err = shh.Subscribe(\u0026asymFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n}\n\nfunc generateTopic(password []byte) {\n\tx := pbkdf2.Key(password, password, 4096, 128, sha512.New)\n\tfor i := 0; i \u003c len(x); i++ {\n\t\ttopic[i%whisper.TopicLength] ^= x[i]\n\t}\n}\n\nfunc waitForConnection(timeout bool) {\n\tvar cnt int\n\tvar connected bool\n\tfor !connected {\n\t\ttime.Sleep(time.Millisecond * 50)\n\t\tconnected = server.PeerCount() \u003e 0\n\t\tif timeout {\n\t\t\tcnt++\n\t\t\tif cnt \u003e 1000 {\n\t\t\t\tutils.Fatalf(\"Timeout expired, failed to connect\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"Connected to peer.\")\n}\n\nfunc run() {\n\terr := startServer()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer server.Stop()\n\tshh.Start(nil)\n\tdefer shh.Stop()\n\n\tif !*forwarderMode {\n\t\tgo messageLoop()\n\t}\n\n\tif *requestMail {\n\t\trequestExpiredMessagesLoop()\n\t} else if *fileExMode {\n\t\tsendFilesLoop()\n\t} else if *fileReader {\n\t\tfileReaderLoop()\n\t} else {\n\t\tsendLoop()\n\t}\n}\n\nfunc shutdown() {\n\tclose(done)\n\tmailServer.Close()\n}\n\nfunc sendLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tsendMsg([]byte(s))\n\t\tif *asymmetricMode {\n//为方便起见,请打印您自己的消息,\n//因为在非对称模式下是不可能解密的\n\t\t\ttimestamp := time.Now().Unix()\n\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: %s\\n\", timestamp, from, s)\n\t\t}\n\t}\n}\n\nfunc sendFilesLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tb, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\n\t\t\th := sendMsg(b)\n\t\t\tif (h == common.Hash{}) {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: message was not sent \\n\")\n\t\t\t} else {\n\t\t\t\ttimestamp := time.Now().Unix()\n\t\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: sent message with hash %x\\n\", timestamp, from, h)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc fileReaderLoop() {\n\twatcher1 := shh.GetFilter(symFilterID)\n\twatcher2 := shh.GetFilter(asymFilterID)\n\tif watcher1 == nil \u0026\u0026 watcher2 == nil {\n\t\tfmt.Println(\"Error: neither symmetric nor asymmetric filter is installed\")\n\t\treturn\n\t}\n\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\traw, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\nenv := whisper.Envelope{Data: raw} //主题为零\nmsg := env.Open(watcher1) //不管主题如何,都强制打开信封\n\t\t\tif msg == nil {\n\t\t\t\tmsg = env.Open(watcher2)\n\t\t\t}\n\t\t\tif msg == nil {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: failed to decrypt the message \\n\")\n\t\t\t} else {\n\t\t\t\tprintMessageInfo(msg)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc scanLine(prompt string) string {\n\tif len(prompt) \u003e 0 {\n\t\tfmt.Print(prompt)\n\t}\n\ttxt, err := input.ReadString(''\\n'')\n\tif err != nil {\n\t\tutils.Fatalf(\"input error: %s\", err)\n\t}\n\ttxt = strings.TrimRight(txt, \"\\n\\r\")\n\treturn txt\n}\n\nfunc scanLineA(prompt string) *string {\n\ts := scanLine(prompt)\n\treturn \u0026s\n}\n\nfunc scanUint(prompt string) uint32 {\n\ts := scanLine(prompt)\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Fail to parse the lower time limit: %s\", err)\n\t}\n\treturn uint32(i)\n}\n\nfunc sendMsg(payload []byte) common.Hash {\n\tparams := whisper.MessageParams{\n\t\tSrc: asymKey,\n\t\tDst: pub,\n\t\tKeySym: symKey,\n\t\tPayload: payload,\n\t\tTopic: topic,\n\t\tTTL: uint32(*argTTL),\n\t\tPoW: *argPoW,\n\t\tWorkTime: uint32(*argWorkTime),\n\t}\n\n\tmsg, err := whisper.NewSentMessage(\u0026params)\n\tif err != nil {\n\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t}\n\n\tenvelope, err := msg.Wrap(\u0026params)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to seal message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\terr = shh.Send(envelope)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to send message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\treturn envelope.Hash()\n}\n\nfunc messageLoop() {\n\tsf := shh.GetFilter(symFilterID)\n\tif sf == nil {\n\t\tutils.Fatalf(\"symmetric filter is not installed\")\n\t}\n\n\taf := shh.GetFilter(asymFilterID)\n\tif af == nil {\n\t\tutils.Fatalf(\"asymmetric filter is not installed\")\n\t}\n\n\tticker := time.NewTicker(time.Millisecond * 50)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-ticker.C:\n\t\t\tm1 := sf.Retrieve()\n\t\t\tm2 := af.Retrieve()\n\t\t\tmessages := append(m1, m2...)\n\t\t\tfor _, msg := range messages {\n\t\t\t\treportedOnce := false\n\t\t\t\tif !*fileExMode \u0026\u0026 len(msg.Payload) \u003c= 2048 {\n\t\t\t\t\tprintMessageInfo(msg)\n\t\t\t\t\treportedOnce = true\n\t\t\t\t}\n\n//在指定argsavedir时保存所有消息。\n//FileExMode仅指定消息保存后如何显示在控制台上。\n//如果fileexmode==true,则只显示哈希值,因为消息可能太大。\n\t\t\t\tif len(*argSaveDir) \u003e 0 {\n\t\t\t\t\twriteMessageToFile(*argSaveDir, msg, !reportedOnce)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc printMessageInfo(msg *whisper.ReceivedMessage) {\ntimestamp := fmt.Sprintf(\"%d\", msg.Sent) //用于诊断的Unix时间戳\n\ttext := string(msg.Payload)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tif whisper.IsPubKeyEqual(msg.Src, \u0026asymKey.PublicKey) {\nfmt.Printf(\"\\n%s \u003c%x\u003e: %s\\n\", timestamp, address, text) //我的信息\n\t} else {\nfmt.Printf(\"\\n%s [%x]: %s\\n\", timestamp, address, text) //来自对等方的消息\n\t}\n}\n\nfunc writeMessageToFile(dir string, msg *whisper.ReceivedMessage, show bool) {\n\tif len(dir) == 0 {\n\t\treturn\n\t}\n\n\ttimestamp := fmt.Sprintf(\"%d\", msg.Sent)\n\tname := fmt.Sprintf(\"%x\", msg.EnvelopeHash)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tenv := shh.GetEnvelope(msg.EnvelopeHash)\n\tif env == nil {\n\t\tfmt.Printf(\"\\nUnexpected error: envelope not found: %x\\n\", msg.EnvelopeHash)\n\t\treturn\n\t}\n\n//这是一个示例代码;如果不想保存自己的消息,请取消注释。\n//如果whisper.ispubkeyequal(msg.src,\u0026asymkey.publickey)\n//fmt.printf(“\\n%s\u003c%x\u003e:我收到的消息,未保存:“%s''\\n”,时间戳,地址,名称)\n//返回\n//}\n\n\tfullpath := filepath.Join(dir, name)\n\terr := ioutil.WriteFile(fullpath, env.Data, 0644)\n\tif err != nil {\n\t\tfmt.Printf(\"\\n%s {%x}: message received but not saved: %s\\n\", timestamp, address, err)\n\t} else if show {\n\t\tfmt.Printf(\"\\n%s {%x}: message received and saved as ''%s'' (%d bytes)\\n\", timestamp, address, name, len(env.Data))\n\t}\n}\n\nfunc requestExpiredMessagesLoop() {\n\tvar key, peerID, bloom []byte\n\tvar timeLow, timeUpp uint32\n\tvar t string\n\tvar xt whisper.TopicType\n\n\tkeyID, err := shh.AddSymKeyFromPassword(msPassword)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to create symmetric key for mail request: %s\", err)\n\t}\n\tkey, err = shh.GetSymKey(keyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to save symmetric key for mail request: %s\", err)\n\t}\n\tpeerID = extractIDFromEnode(*argEnode)\n\tshh.AllowP2PMessagesFromPeer(peerID)\n\n\tfor {\n\t\ttimeLow = scanUint(\"Please enter the lower limit of the time range (unix timestamp): \")\n\t\ttimeUpp = scanUint(\"Please enter the upper limit of the time range (unix timestamp): \")\n\t\tt = scanLine(\"Enter the topic (hex). Press enter to request all messages, regardless of the topic: \")\n\t\tif len(t) == whisper.TopicLength*2 {\n\t\t\tx, err := hex.DecodeString(t)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to parse the topic: %s \\n\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txt = whisper.BytesToTopic(x)\n\t\t\tbloom = whisper.TopicToBloom(xt)\n\t\t\tobfuscateBloom(bloom)\n\t\t} else if len(t) == 0 {\n\t\t\tbloom = whisper.MakeFullNodeBloom()\n\t\t} else {\n\t\t\tfmt.Println(\"Error: topic is invalid, request aborted\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif timeUpp == 0 {\n\t\t\ttimeUpp = 0xFFFFFFFF\n\t\t}\n\n\t\tdata := make([]byte, 8, 8+whisper.BloomFilterSize)\n\t\tbinary.BigEndian.PutUint32(data, timeLow)\n\t\tbinary.BigEndian.PutUint32(data[4:], timeUpp)\n\t\tdata = append(data, bloom...)\n\n\t\tvar params whisper.MessageParams\n\t\tparams.PoW = *argServerPoW\n\t\tparams.Payload = data\n\t\tparams.KeySym = key\n\t\tparams.Src = asymKey\n\t\tparams.WorkTime = 5\n\n\t\tmsg, err := whisper.NewSentMessage(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t\t}\n\t\tenv, err := msg.Wrap(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Wrap failed: %s\", err)\n\t\t}\n\n\t\terr = shh.RequestHistoricMessages(peerID, env)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to send P2P message: %s\", err)\n\t\t}\n\n\t\ttime.Sleep(time.Second * 5)\n\t}\n}\n\nfunc extractIDFromEnode(s string) []byte {\n\tn, err := enode.ParseV4(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to parse enode: %s\", err)\n\t}\n\treturn n.ID().Bytes()\n}\n\n//模糊布卢姆增加16个随机位到布卢姆\n//筛选,以便混淆包含的主题。\n//它在每个会话中都具有确定性。\n//尽管有额外的位,它将平均匹配\n//比完整节点的Bloom过滤器少32000倍的消息。\nfunc obfuscateBloom(bloom []byte) {\n\tconst half = entropySize / 2\n\tfor i := 0; i \u003c half; i++ {\n\t\tx := int(entropy[i])\n\t\tif entropy[half+i] \u003c 128 {\n\t\t\tx += 256\n\t\t}\n\nbloom[x/8] = 1 \u003c\u003c uint(x%8) //设置位号x\n\t}\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":116,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum"},"file":{"path":"cmd/wnode/main.go","url":"/github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/-/blob/cmd/wnode/main.go","content":"\n//此源码被清华学神尹成大魔王专业翻译分析并修改\n//尹成QQ77025077\n//尹成微信18510341407\n//尹成所在QQ群721929980\n//尹成邮箱 yinc13@mails.tsinghua.edu.cn\n//尹成毕业于清华大学,微软区块链领域全球最有价值专家\n//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620\n//版权所有2017 Go Ethereum作者\n//此文件是Go以太坊的一部分。\n//\n//Go以太坊是免费软件:您可以重新发布和/或修改它\n//根据GNU通用公共许可证的条款\n//自由软件基金会,或者许可证的第3版,或者\n//(由您选择)任何更高版本。\n//\n//Go以太坊的分布希望它会有用,\n//但没有任何保证;甚至没有\n//适销性或特定用途的适用性。见\n//GNU通用公共许可证了解更多详细信息。\n//\n//你应该已经收到一份GNU通用公共许可证的副本\n//一起去以太坊吧。如果没有,请参见\u003chttp://www.gnu.org/licenses/\u003e。\n\n//这是一个简单的耳语节点。它可以用作独立的引导节点。\n//也可用于不同的测试和诊断目的。\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"crypto/ecdsa\"\n\tcrand \"crypto/rand\"\n\t\"crypto/sha512\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"flag\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/ethereum/go-ethereum/cmd/utils\"\n\t\"github.com/ethereum/go-ethereum/common\"\n\t\"github.com/ethereum/go-ethereum/console\"\n\t\"github.com/ethereum/go-ethereum/crypto\"\n\t\"github.com/ethereum/go-ethereum/log\"\n\t\"github.com/ethereum/go-ethereum/p2p\"\n\t\"github.com/ethereum/go-ethereum/p2p/discover\"\n\t\"github.com/ethereum/go-ethereum/p2p/nat\"\n\t\"github.com/ethereum/go-ethereum/whisper/mailserver\"\n\twhisper \"github.com/ethereum/go-ethereum/whisper/whisperv6\"\n\t\"golang.org/x/crypto/pbkdf2\"\n)\n\nconst quitCommand = \"~Q\"\nconst entropySize = 32\n\n//独生子女\nvar (\n\tserver *p2p.Server\n\tshh *whisper.Whisper\n\tdone chan struct{}\n\tmailServer mailserver.WMailServer\n\tentropy [entropySize]byte\n\n\tinput = bufio.NewReader(os.Stdin)\n)\n\n//加密\nvar (\n\tsymKey []byte\n\tpub *ecdsa.PublicKey\n\tasymKey *ecdsa.PrivateKey\n\tnodeid *ecdsa.PrivateKey\n\ttopic whisper.TopicType\n\n\tasymKeyID string\n\tasymFilterID string\n\tsymFilterID string\n\tsymPass string\n\tmsPassword string\n)\n\n//CMD参数\nvar (\n\tbootstrapMode = flag.Bool(\"standalone\", false, \"boostrap node: don''t initiate connection to peers, just wait for incoming connections\")\n\tforwarderMode = flag.Bool(\"forwarder\", false, \"forwarder mode: only forward messages, neither encrypt nor decrypt messages\")\n\tmailServerMode = flag.Bool(\"mailserver\", false, \"mail server mode: delivers expired messages on demand\")\n\trequestMail = flag.Bool(\"mailclient\", false, \"request expired messages from the bootstrap server\")\n\tasymmetricMode = flag.Bool(\"asym\", false, \"use asymmetric encryption\")\n\tgenerateKey = flag.Bool(\"generatekey\", false, \"generate and show the private key\")\n\tfileExMode = flag.Bool(\"fileexchange\", false, \"file exchange mode\")\n\tfileReader = flag.Bool(\"filereader\", false, \"load and decrypt messages saved as files, display as plain text\")\n\ttestMode = flag.Bool(\"test\", false, \"use of predefined parameters for diagnostics (password, etc.)\")\n\techoMode = flag.Bool(\"echo\", false, \"echo mode: prints some arguments for diagnostics\")\n\n\targVerbosity = flag.Int(\"verbosity\", int(log.LvlError), \"log verbosity level\")\n\targTTL = flag.Uint(\"ttl\", 30, \"time-to-live for messages in seconds\")\n\targWorkTime = flag.Uint(\"work\", 5, \"work time in seconds\")\n\targMaxSize = flag.Uint(\"maxsize\", uint(whisper.DefaultMaxMessageSize), \"max size of message\")\n\targPoW = flag.Float64(\"pow\", whisper.DefaultMinimumPoW, \"PoW for normal messages in float format (e.g. 2.7)\")\n\targServerPoW = flag.Float64(\"mspow\", whisper.DefaultMinimumPoW, \"PoW requirement for Mail Server request\")\n\n\targIP = flag.String(\"ip\", \"\", \"IP address and port of this node (e.g. 127.0.0.1:30303)\")\n\targPub = flag.String(\"pub\", \"\", \"public key for asymmetric encryption\")\n\targDBPath = flag.String(\"dbpath\", \"\", \"path to the server''s DB directory\")\n\targIDFile = flag.String(\"idfile\", \"\", \"file name with node id (private key)\")\nargEnode = flag.String(\"boot\", \"\", \"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\n\targTopic = flag.String(\"topic\", \"\", \"topic in hexadecimal format (e.g. 70a4beef)\")\n\targSaveDir = flag.String(\"savedir\", \"\", \"directory where all incoming messages will be saved as files\")\n)\n\nfunc main() {\n\tprocessArgs()\n\tinitialize()\n\trun()\n\tshutdown()\n}\n\nfunc processArgs() {\n\tflag.Parse()\n\n\tif len(*argIDFile) \u003e 0 {\n\t\tvar err error\n\t\tnodeid, err = crypto.LoadECDSA(*argIDFile)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to load file [%s]: %s.\", *argIDFile, err)\n\t\t}\n\t}\n\nconst enodePrefix = \"enode://“\n\tif len(*argEnode) \u003e 0 {\n\t\tif (*argEnode)[:len(enodePrefix)] != enodePrefix {\n\t\t\t*argEnode = enodePrefix + *argEnode\n\t\t}\n\t}\n\n\tif len(*argTopic) \u003e 0 {\n\t\tx, err := hex.DecodeString(*argTopic)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to parse the topic: %s\", err)\n\t\t}\n\t\ttopic = whisper.BytesToTopic(x)\n\t}\n\n\tif *asymmetricMode \u0026\u0026 len(*argPub) \u003e 0 {\n\t\tvar err error\n\t\tif pub, err = crypto.UnmarshalPubkey(common.FromHex(*argPub)); err != nil {\n\t\t\tutils.Fatalf(\"invalid public key\")\n\t\t}\n\t}\n\n\tif len(*argSaveDir) \u003e 0 {\n\t\tif _, err := os.Stat(*argSaveDir); os.IsNotExist(err) {\n\t\t\tutils.Fatalf(\"Download directory ''%s'' does not exist\", *argSaveDir)\n\t\t}\n\t} else if *fileExMode {\n\t\tutils.Fatalf(\"Parameter ''savedir'' is mandatory for file exchange mode\")\n\t}\n\n\tif *echoMode {\n\t\techo()\n\t}\n}\n\nfunc echo() {\n\tfmt.Printf(\"ttl = %d \\n\", *argTTL)\n\tfmt.Printf(\"workTime = %d \\n\", *argWorkTime)\n\tfmt.Printf(\"pow = %f \\n\", *argPoW)\n\tfmt.Printf(\"mspow = %f \\n\", *argServerPoW)\n\tfmt.Printf(\"ip = %s \\n\", *argIP)\n\tfmt.Printf(\"pub = %s \\n\", common.ToHex(crypto.FromECDSAPub(pub)))\n\tfmt.Printf(\"idfile = %s \\n\", *argIDFile)\n\tfmt.Printf(\"dbpath = %s \\n\", *argDBPath)\n\tfmt.Printf(\"boot = %s \\n\", *argEnode)\n}\n\nfunc initialize() {\n\tlog.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*argVerbosity), log.StreamHandler(os.Stderr, log.TerminalFormat(false))))\n\n\tdone = make(chan struct{})\n\tvar peers []*discover.Node\n\tvar err error\n\n\tif *generateKey {\n\t\tkey, err := crypto.GenerateKey()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate private key: %s\", err)\n\t\t}\n\t\tk := hex.EncodeToString(crypto.FromECDSA(key))\n\t\tfmt.Printf(\"Random private key: %s \\n\", k)\n\t\tos.Exit(0)\n\t}\n\n\tif *testMode {\nsymPass = \"wwww\" //ASCII码:0x77777777\n\t\tmsPassword = \"wwww\"\n\t}\n\n\tif *bootstrapMode {\n\t\tif len(*argIP) == 0 {\n\t\t\targIP = scanLineA(\"Please enter your IP and port (e.g. 127.0.0.1:30348): \")\n\t\t}\n\t} else if *fileReader {\n\t\t*bootstrapMode = true\n\t} else {\n\t\tif len(*argEnode) == 0 {\n\t\t\targEnode = scanLineA(\"Please enter the peer''s enode: \")\n\t\t}\n\t\tpeer := discover.MustParseNode(*argEnode)\n\t\tpeers = append(peers, peer)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tcfg := \u0026whisper.Config{\n\t\tMaxMessageSize: uint32(*argMaxSize),\n\t\tMinimumAcceptedPOW: *argPoW,\n\t}\n\n\tshh = whisper.New(cfg)\n\n\tif *argPoW != whisper.DefaultMinimumPoW {\n\t\terr := shh.SetMinimumPoW(*argPoW)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set PoW: %s\", err)\n\t\t}\n\t}\n\n\tif uint32(*argMaxSize) != whisper.DefaultMaxMessageSize {\n\t\terr := shh.SetMaxMessageSize(uint32(*argMaxSize))\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set max message size: %s\", err)\n\t\t}\n\t}\n\n\tasymKeyID, err = shh.NewKeyPair()\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t}\n\n\tasymKey, err = shh.GetPrivateKey(asymKeyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t}\n\n\tif nodeid == nil {\n\t\ttmpID, err := shh.NewKeyPair()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t\t}\n\n\t\tnodeid, err = shh.GetPrivateKey(tmpID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t\t}\n\t}\n\n\tmaxPeers := 80\n\tif *bootstrapMode {\n\t\tmaxPeers = 800\n\t}\n\n\t_, err = crand.Read(entropy[:])\n\tif err != nil {\n\t\tutils.Fatalf(\"crypto/rand failed: %s\", err)\n\t}\n\n\tif *mailServerMode {\n\t\tshh.RegisterServer(\u0026mailServer)\n\t\tif err := mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW); err != nil {\n\t\t\tutils.Fatalf(\"Failed to init MailServer: %s\", err)\n\t\t}\n\t}\n\n\tserver = \u0026p2p.Server{\n\t\tConfig: p2p.Config{\n\t\t\tPrivateKey: nodeid,\n\t\t\tMaxPeers: maxPeers,\n\t\t\tName: common.MakeName(\"wnode\", \"6.0\"),\n\t\t\tProtocols: shh.Protocols(),\n\t\t\tListenAddr: *argIP,\n\t\t\tNAT: nat.Any(),\n\t\t\tBootstrapNodes: peers,\n\t\t\tStaticNodes: peers,\n\t\t\tTrustedNodes: peers,\n\t\t},\n\t}\n}\n\nfunc startServer() error {\n\terr := server.Start()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to start Whisper peer: %s.\", err)\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"my public key: %s \\n\", common.ToHex(crypto.FromECDSAPub(\u0026asymKey.PublicKey)))\n\tfmt.Println(server.NodeInfo().Enode)\n\n\tif *bootstrapMode {\n\t\tconfigureNode()\n\t\tfmt.Println(\"Bootstrap Whisper node started\")\n\t} else {\n\t\tfmt.Println(\"Whisper node started\")\n//首先看看我们是否可以建立连接,然后请求用户输入\n\t\twaitForConnection(true)\n\t\tconfigureNode()\n\t}\n\n\tif *fileExMode {\n\t\tfmt.Printf(\"Please type the file name to be send. To quit type: ''%s''\\n\", quitCommand)\n\t} else if *fileReader {\n\t\tfmt.Printf(\"Please type the file name to be decrypted. To quit type: ''%s''\\n\", quitCommand)\n\t} else if !*forwarderMode {\n\t\tfmt.Printf(\"Please type the message. To quit type: ''%s''\\n\", quitCommand)\n\t}\n\treturn nil\n}\n\nfunc configureNode() {\n\tvar err error\n\tvar p2pAccept bool\n\n\tif *forwarderMode {\n\t\treturn\n\t}\n\n\tif *asymmetricMode {\n\t\tif len(*argPub) == 0 {\n\t\t\ts := scanLine(\"Please enter the peer''s public key: \")\n\t\t\tb := common.FromHex(s)\n\t\t\tif b == nil {\n\t\t\t\tutils.Fatalf(\"Error: can not convert hexadecimal string\")\n\t\t\t}\n\t\t\tif pub, err = crypto.UnmarshalPubkey(b); err != nil {\n\t\t\t\tutils.Fatalf(\"Error: invalid peer public key\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif *requestMail {\n\t\tp2pAccept = true\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !*asymmetricMode \u0026\u0026 !*forwarderMode {\n\t\tif len(symPass) == 0 {\n\t\t\tsymPass, err = console.Stdin.PromptPassword(\"Please enter the password for symmetric encryption: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read passphrase: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tsymKeyID, err := shh.AddSymKeyFromPassword(symPass)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to create symmetric key: %s\", err)\n\t\t}\n\t\tsymKey, err = shh.GetSymKey(symKeyID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to save symmetric key: %s\", err)\n\t\t}\n\t\tif len(*argTopic) == 0 {\n\t\t\tgenerateTopic([]byte(symPass))\n\t\t}\n\n\t\tfmt.Printf(\"Filter is configured for the topic: %x \\n\", topic)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(*argDBPath) == 0 {\n\t\t\targDBPath = scanLineA(\"Please enter the path to DB file: \")\n\t\t}\n\t}\n\n\tsymFilter := whisper.Filter{\n\t\tKeySym: symKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tsymFilterID, err = shh.Subscribe(\u0026symFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n\n\tasymFilter := whisper.Filter{\n\t\tKeyAsym: asymKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tasymFilterID, err = shh.Subscribe(\u0026asymFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n}\n\nfunc generateTopic(password []byte) {\n\tx := pbkdf2.Key(password, password, 4096, 128, sha512.New)\n\tfor i := 0; i \u003c len(x); i++ {\n\t\ttopic[i%whisper.TopicLength] ^= x[i]\n\t}\n}\n\nfunc waitForConnection(timeout bool) {\n\tvar cnt int\n\tvar connected bool\n\tfor !connected {\n\t\ttime.Sleep(time.Millisecond * 50)\n\t\tconnected = server.PeerCount() \u003e 0\n\t\tif timeout {\n\t\t\tcnt++\n\t\t\tif cnt \u003e 1000 {\n\t\t\t\tutils.Fatalf(\"Timeout expired, failed to connect\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"Connected to peer.\")\n}\n\nfunc run() {\n\terr := startServer()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer server.Stop()\n\tshh.Start(nil)\n\tdefer shh.Stop()\n\n\tif !*forwarderMode {\n\t\tgo messageLoop()\n\t}\n\n\tif *requestMail {\n\t\trequestExpiredMessagesLoop()\n\t} else if *fileExMode {\n\t\tsendFilesLoop()\n\t} else if *fileReader {\n\t\tfileReaderLoop()\n\t} else {\n\t\tsendLoop()\n\t}\n}\n\nfunc shutdown() {\n\tclose(done)\n\tmailServer.Close()\n}\n\nfunc sendLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tsendMsg([]byte(s))\n\t\tif *asymmetricMode {\n//为方便起见,请打印您自己的消息,\n//因为在非对称模式下是不可能解密的\n\t\t\ttimestamp := time.Now().Unix()\n\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: %s\\n\", timestamp, from, s)\n\t\t}\n\t}\n}\n\nfunc sendFilesLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tb, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\n\t\t\th := sendMsg(b)\n\t\t\tif (h == common.Hash{}) {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: message was not sent \\n\")\n\t\t\t} else {\n\t\t\t\ttimestamp := time.Now().Unix()\n\t\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: sent message with hash %x\\n\", timestamp, from, h)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc fileReaderLoop() {\n\twatcher1 := shh.GetFilter(symFilterID)\n\twatcher2 := shh.GetFilter(asymFilterID)\n\tif watcher1 == nil \u0026\u0026 watcher2 == nil {\n\t\tfmt.Println(\"Error: neither symmetric nor asymmetric filter is installed\")\n\t\treturn\n\t}\n\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\traw, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\nenv := whisper.Envelope{Data: raw} //主题为零\nmsg := env.Open(watcher1) //不管主题如何,都强制打开信封\n\t\t\tif msg == nil {\n\t\t\t\tmsg = env.Open(watcher2)\n\t\t\t}\n\t\t\tif msg == nil {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: failed to decrypt the message \\n\")\n\t\t\t} else {\n\t\t\t\tprintMessageInfo(msg)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc scanLine(prompt string) string {\n\tif len(prompt) \u003e 0 {\n\t\tfmt.Print(prompt)\n\t}\n\ttxt, err := input.ReadString(''\\n'')\n\tif err != nil {\n\t\tutils.Fatalf(\"input error: %s\", err)\n\t}\n\ttxt = strings.TrimRight(txt, \"\\n\\r\")\n\treturn txt\n}\n\nfunc scanLineA(prompt string) *string {\n\ts := scanLine(prompt)\n\treturn \u0026s\n}\n\nfunc scanUint(prompt string) uint32 {\n\ts := scanLine(prompt)\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Fail to parse the lower time limit: %s\", err)\n\t}\n\treturn uint32(i)\n}\n\nfunc sendMsg(payload []byte) common.Hash {\n\tparams := whisper.MessageParams{\n\t\tSrc: asymKey,\n\t\tDst: pub,\n\t\tKeySym: symKey,\n\t\tPayload: payload,\n\t\tTopic: topic,\n\t\tTTL: uint32(*argTTL),\n\t\tPoW: *argPoW,\n\t\tWorkTime: uint32(*argWorkTime),\n\t}\n\n\tmsg, err := whisper.NewSentMessage(\u0026params)\n\tif err != nil {\n\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t}\n\n\tenvelope, err := msg.Wrap(\u0026params)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to seal message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\terr = shh.Send(envelope)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to send message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\treturn envelope.Hash()\n}\n\nfunc messageLoop() {\n\tsf := shh.GetFilter(symFilterID)\n\tif sf == nil {\n\t\tutils.Fatalf(\"symmetric filter is not installed\")\n\t}\n\n\taf := shh.GetFilter(asymFilterID)\n\tif af == nil {\n\t\tutils.Fatalf(\"asymmetric filter is not installed\")\n\t}\n\n\tticker := time.NewTicker(time.Millisecond * 50)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-ticker.C:\n\t\t\tm1 := sf.Retrieve()\n\t\t\tm2 := af.Retrieve()\n\t\t\tmessages := append(m1, m2...)\n\t\t\tfor _, msg := range messages {\n\t\t\t\treportedOnce := false\n\t\t\t\tif !*fileExMode \u0026\u0026 len(msg.Payload) \u003c= 2048 {\n\t\t\t\t\tprintMessageInfo(msg)\n\t\t\t\t\treportedOnce = true\n\t\t\t\t}\n\n//在指定argsavedir时保存所有消息。\n//\n//如果fileexmode==true,则只显示哈希值,因为消息可能太大。\n\t\t\t\tif len(*argSaveDir) \u003e 0 {\n\t\t\t\t\twriteMessageToFile(*argSaveDir, msg, !reportedOnce)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc printMessageInfo(msg *whisper.ReceivedMessage) {\ntimestamp := fmt.Sprintf(\"%d\", msg.Sent) //用于诊断的Unix时间戳\n\ttext := string(msg.Payload)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tif whisper.IsPubKeyEqual(msg.Src, \u0026asymKey.PublicKey) {\nfmt.Printf(\"\\n%s \u003c%x\u003e: %s\\n\", timestamp, address, text) //我的信息\n\t} else {\nfmt.Printf(\"\\n%s [%x]: %s\\n\", timestamp, address, text) //\n\t}\n}\n\nfunc writeMessageToFile(dir string, msg *whisper.ReceivedMessage, show bool) {\n\tif len(dir) == 0 {\n\t\treturn\n\t}\n\n\ttimestamp := fmt.Sprintf(\"%d\", msg.Sent)\n\tname := fmt.Sprintf(\"%x\", msg.EnvelopeHash)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tenv := shh.GetEnvelope(msg.EnvelopeHash)\n\tif env == nil {\n\t\tfmt.Printf(\"\\nUnexpected error: envelope not found: %x\\n\", msg.EnvelopeHash)\n\t\treturn\n\t}\n\n//这是一个示例代码;如果不想保存自己的消息,请取消注释。\n//如果whisper.ispubkeyequal(msg.src,\u0026asymkey.publickey)\n//fmt.printf(“\\n%s\u003c%x\u003e:我收到的消息,未保存:“%s''\\n”,时间戳,地址,名称)\n//返回\n//}\n\n\tfullpath := filepath.Join(dir, name)\n\terr := ioutil.WriteFile(fullpath, env.Data, 0644)\n\tif err != nil {\n\t\tfmt.Printf(\"\\n%s {%x}: message received but not saved: %s\\n\", timestamp, address, err)\n\t} else if show {\n\t\tfmt.Printf(\"\\n%s {%x}: message received and saved as ''%s'' (%d bytes)\\n\", timestamp, address, name, len(env.Data))\n\t}\n}\n\nfunc requestExpiredMessagesLoop() {\n\tvar key, peerID, bloom []byte\n\tvar timeLow, timeUpp uint32\n\tvar t string\n\tvar xt whisper.TopicType\n\n\tkeyID, err := shh.AddSymKeyFromPassword(msPassword)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to create symmetric key for mail request: %s\", err)\n\t}\n\tkey, err = shh.GetSymKey(keyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to save symmetric key for mail request: %s\", err)\n\t}\n\tpeerID = extractIDFromEnode(*argEnode)\n\tshh.AllowP2PMessagesFromPeer(peerID)\n\n\tfor {\n\t\ttimeLow = scanUint(\"Please enter the lower limit of the time range (unix timestamp): \")\n\t\ttimeUpp = scanUint(\"Please enter the upper limit of the time range (unix timestamp): \")\n\t\tt = scanLine(\"Enter the topic (hex). Press enter to request all messages, regardless of the topic: \")\n\t\tif len(t) == whisper.TopicLength*2 {\n\t\t\tx, err := hex.DecodeString(t)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to parse the topic: %s \\n\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txt = whisper.BytesToTopic(x)\n\t\t\tbloom = whisper.TopicToBloom(xt)\n\t\t\tobfuscateBloom(bloom)\n\t\t} else if len(t) == 0 {\n\t\t\tbloom = whisper.MakeFullNodeBloom()\n\t\t} else {\n\t\t\tfmt.Println(\"Error: topic is invalid, request aborted\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif timeUpp == 0 {\n\t\t\ttimeUpp = 0xFFFFFFFF\n\t\t}\n\n\t\tdata := make([]byte, 8, 8+whisper.BloomFilterSize)\n\t\tbinary.BigEndian.PutUint32(data, timeLow)\n\t\tbinary.BigEndian.PutUint32(data[4:], timeUpp)\n\t\tdata = append(data, bloom...)\n\n\t\tvar params whisper.MessageParams\n\t\tparams.PoW = *argServerPoW\n\t\tparams.Payload = data\n\t\tparams.KeySym = key\n\t\tparams.Src = asymKey\n\t\tparams.WorkTime = 5\n\n\t\tmsg, err := whisper.NewSentMessage(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t\t}\n\t\tenv, err := msg.Wrap(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Wrap failed: %s\", err)\n\t\t}\n\n\t\terr = shh.RequestHistoricMessages(peerID, env)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to send P2P message: %s\", err)\n\t\t}\n\n\t\ttime.Sleep(time.Second * 5)\n\t}\n}\n\nfunc extractIDFromEnode(s string) []byte {\n\tn, err := discover.ParseNode(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to parse enode: %s\", err)\n\t}\n\treturn n.ID[:]\n}\n\n//模糊布卢姆增加16个随机位的布卢姆\n//筛选,以便混淆包含的主题。\n//它在每个会话中都具有确定性。\n//尽管有额外的位,它将平均匹配\n//比完整节点的Bloom过滤器少32000倍的消息。\nfunc obfuscateBloom(bloom []byte) {\n\tconst half = entropySize / 2\n\tfor i := 0; i \u003c half; i++ {\n\t\tx := int(entropy[i])\n\t\tif entropy[half+i] \u003c 128 {\n\t\t\tx += 256\n\t\t}\n\nbloom[x/8] = 1 \u003c\u003c uint(x%8) //设置位号x\n\t}\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":116,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/driver_x11.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_x11.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build (linux \u0026\u0026 !android) || dragonfly || openbsd\n\npackage driver\n\nimport (\n\t\"golang.org/x/exp/shiny/driver/x11driver\"\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\nfunc main(f func(screen.Screen)) {\n\tx11driver.Main(f)\n}\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) {","lineNumber":13,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/gldriver/x11.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/x11.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build (linux \u0026\u0026 !android) || openbsd\n\npackage gldriver\n\n/*\n#cgo linux LDFLAGS: -lEGL -lGLESv2 -lX11\n#cgo openbsd LDFLAGS: -L/usr/X11R6/lib/ -lEGL -lGLESv2 -lX11\n\n#cgo openbsd CFLAGS: -I/usr/X11R6/include/\n\n#include \u003cstdbool.h\u003e\n#include \u003cstdint.h\u003e\n#include \u003cstdlib.h\u003e\n\nchar *eglGetErrorStr();\nvoid startDriver();\nvoid processEvents();\nvoid makeCurrent(uintptr_t ctx);\nvoid swapBuffers(uintptr_t ctx);\nvoid doCloseWindow(uintptr_t id);\nuintptr_t doNewWindow(int width, int height, char* title, int title_len);\nuintptr_t doShowWindow(uintptr_t id);\nuintptr_t surfaceCreate();\n*/\nimport \"C\"\nimport (\n\t\"errors\"\n\t\"runtime\"\n\t\"time\"\n\t\"unsafe\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/x11key\"\n\t\"golang.org/x/exp/shiny/screen\"\n\t\"golang.org/x/mobile/event/key\"\n\t\"golang.org/x/mobile/event/mouse\"\n\t\"golang.org/x/mobile/event/paint\"\n\t\"golang.org/x/mobile/event/size\"\n\t\"golang.org/x/mobile/geom\"\n\t\"golang.org/x/mobile/gl\"\n)\n\nconst useLifecycler = true\n\nconst handleSizeEventsAtChannelReceive = true\n\nvar theKeysyms x11key.KeysymTable\n\nfunc init() {\n\t// It might not be necessary, but it probably doesn''t hurt to try to make\n\t// ''the main thread'' be ''the X11 / OpenGL thread''.\n\truntime.LockOSThread()\n}\n\nfunc newWindow(opts *screen.NewWindowOptions) (uintptr, error) {\n\twidth, height := optsSize(opts)\n\n\ttitle := opts.GetTitle()\n\tctitle := C.CString(title)\n\tdefer C.free(unsafe.Pointer(ctitle))\n\n\tretc := make(chan uintptr)\n\tuic \u003c- uiClosure{\n\t\tf: func() uintptr {\n\t\t\treturn uintptr(C.doNewWindow(C.int(width), C.int(height), ctitle, C.int(len(title))))\n\t\t},\n\t\tretc: retc,\n\t}\n\treturn \u003c-retc, nil\n}\n\nfunc initWindow(w *windowImpl) {\n\tw.glctx, w.worker = glctx, worker\n}\n\nfunc showWindow(w *windowImpl) {\n\tretc := make(chan uintptr)\n\tuic \u003c- uiClosure{\n\t\tf: func() uintptr {\n\t\t\treturn uintptr(C.doShowWindow(C.uintptr_t(w.id)))\n\t\t},\n\t\tretc: retc,\n\t}\n\tw.ctx = \u003c-retc\n\tgo drawLoop(w)\n}\n\nfunc closeWindow(id uintptr) {\n\tuic \u003c- uiClosure{\n\t\tf: func() uintptr {\n\t\t\tC.doCloseWindow(C.uintptr_t(id))\n\t\t\treturn 0\n\t\t},\n\t}\n}\n\nfunc drawLoop(w *windowImpl) {\n\tglcontextc \u003c- w.ctx.(uintptr)\n\tgo func() {\n\t\tfor range w.publish {\n\t\t\tpublishc \u003c- w\n\t\t}\n\t}()\n}\n\nvar (\n\tglcontextc = make(chan uintptr)\n\tpublishc = make(chan *windowImpl)\n\tuic = make(chan uiClosure)\n\n\t// TODO: don''t assume that there is only one window, and hence only\n\t// one (global) GL context.\n\t//\n\t// TODO: should we be able to make a shiny.Texture before having a\n\t// shiny.Window''s GL context? Should something like gl.IsProgram be a\n\t// method instead of a function, and have each shiny.Window have its own\n\t// gl.Context?\n\tglctx gl.Context\n\tworker gl.Worker\n)\n\n// uiClosure is a closure to be run on C''s UI thread.\ntype uiClosure struct {\n\tf func() uintptr\n\tretc chan uintptr\n}\n\nfunc main(f func(screen.Screen)) error {\n\tif gl.Version() == \"GL_ES_2_0\" {\n\t\treturn errors.New(\"gldriver: ES 3 required on X11\")\n\t}\n\tC.startDriver()\n\tglctx, worker = gl.NewContext()\n\n\tclosec := make(chan struct{})\n\tgo func() {\n\t\tf(theScreen)\n\t\tclose(closec)\n\t}()\n\n\t// heartbeat is a channel that, at regular intervals, directs the select\n\t// below to also consider X11 events, not just Go events (channel\n\t// communications).\n\t//\n\t// TODO: select instead of poll. Note that knowing whether to call\n\t// C.processEvents needs to select on a file descriptor, and the other\n\t// cases below select on Go channels.\n\theartbeat := time.NewTicker(time.Second / 60)\n\tworkAvailable := worker.WorkAvailable()\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-closec:\n\t\t\treturn nil\n\t\tcase ctx := \u003c-glcontextc:\n\t\t\t// TODO: do we need to synchronize with seeing a size event for\n\t\t\t// this window''s context before or after calling makeCurrent?\n\t\t\t// Otherwise, are we racing with the gl.Viewport call? I''ve\n\t\t\t// occasionally seen a stale viewport, if the window manager sets\n\t\t\t// the window width and height to something other than that\n\t\t\t// requested by XCreateWindow, but it''s not easily reproducible.\n\t\t\tC.makeCurrent(C.uintptr_t(ctx))\n\t\tcase w := \u003c-publishc:\n\t\t\tC.swapBuffers(C.uintptr_t(w.ctx.(uintptr)))\n\t\t\tw.publishDone \u003c- screen.PublishResult{}\n\t\tcase req := \u003c-uic:\n\t\t\tret := req.f()\n\t\t\tif req.retc != nil {\n\t\t\t\treq.retc \u003c- ret\n\t\t\t}\n\t\tcase \u003c-heartbeat.C:\n\t\t\tC.processEvents()\n\t\tcase \u003c-workAvailable:\n\t\t\tworker.DoWork()\n\t\t}\n\t}\n}\n\n//export onExpose\nfunc onExpose(id uintptr) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn\n\t}\n\n\tw.Send(paint.Event{External: true})\n}\n\n//export onKeysym\nfunc onKeysym(k, unshifted, shifted uint32) {\n\ttheKeysyms.Table[k][0] = unshifted\n\ttheKeysyms.Table[k][1] = shifted\n}\n\n//export onKey\nfunc onKey(id uintptr, state uint16, detail, dir uint8) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn\n\t}\n\n\tr, c := theKeysyms.Lookup(detail, state)\n\tw.Send(key.Event{\n\t\tRune: r,\n\t\tCode: c,\n\t\tModifiers: x11key.KeyModifiers(state),\n\t\tDirection: key.Direction(dir),\n\t})\n}\n\n//export onMouse\nfunc onMouse(id uintptr, x, y int32, state uint16, button, dir uint8) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn\n\t}\n\n\t// TODO: should a mouse.Event have a separate MouseModifiers field, for\n\t// which buttons are pressed during a mouse move?\n\tbtn := mouse.Button(button)\n\tswitch btn {\n\tcase 4:\n\t\tbtn = mouse.ButtonWheelUp\n\tcase 5:\n\t\tbtn = mouse.ButtonWheelDown\n\tcase 6:\n\t\tbtn = mouse.ButtonWheelLeft\n\tcase 7:\n\t\tbtn = mouse.ButtonWheelRight\n\t}\n\tif btn.IsWheel() {\n\t\tif dir != uint8(mouse.DirPress) {\n\t\t\treturn\n\t\t}\n\t\tdir = uint8(mouse.DirStep)\n\t}\n\tw.Send(mouse.Event{\n\t\tX: float32(x),\n\t\tY: float32(y),\n\t\tButton: btn,\n\t\tModifiers: x11key.KeyModifiers(state),\n\t\tDirection: mouse.Direction(dir),\n\t})\n}\n\n//export onFocus\nfunc onFocus(id uintptr, focused bool) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn\n\t}\n\n\tw.lifecycler.SetFocused(focused)\n\tw.lifecycler.SendEvent(w, w.glctx)\n}\n\n//export onConfigure\nfunc onConfigure(id uintptr, x, y, width, height, displayWidth, displayWidthMM int32) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn\n\t}\n\n\tw.lifecycler.SetVisible(x+width \u003e 0 \u0026\u0026 y+height \u003e 0)\n\tw.lifecycler.SendEvent(w, w.glctx)\n\n\tconst (\n\t\tmmPerInch = 25.4\n\t\tptPerInch = 72\n\t)\n\tpixelsPerMM := float32(displayWidth) / float32(displayWidthMM)\n\tw.Send(size.Event{\n\t\tWidthPx: int(width),\n\t\tHeightPx: int(height),\n\t\tWidthPt: geom.Pt(width),\n\t\tHeightPt: geom.Pt(height),\n\t\tPixelsPerPt: pixelsPerMM * mmPerInch / ptPerInch,\n\t})\n}\n\n//export onDeleteWindow\nfunc onDeleteWindow(id uintptr) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn\n\t}\n\n\tw.lifecycler.SetDead(true)\n\tw.lifecycler.SendEvent(w, w.glctx)\n}\n\nfunc surfaceCreate() error {\n\tif C.surfaceCreate() == 0 {\n\t\treturn errors.New(\"gldriver: surface creation failed\")\n\t}\n\treturn nil\n}\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) error {","lineNumber":130,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/driver_darwin.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_darwin.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build darwin \u0026\u0026 !metal\n\npackage driver\n\nimport (\n\t\"golang.org/x/exp/shiny/driver/gldriver\"\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\nfunc main(f func(screen.Screen)) {\n\tgldriver.Main(f)\n}\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) {","lineNumber":13,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/gldriver/cocoa.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/cocoa.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build darwin \u0026\u0026 !ios\n\npackage gldriver\n\n/*\n#cgo CFLAGS: -x objective-c -DGL_SILENCE_DEPRECATION\n#cgo LDFLAGS: -framework Cocoa -framework OpenGL\n#include \u003cOpenGL/gl3.h\u003e\n#import \u003cCarbon/Carbon.h\u003e // for HIToolbox/Events.h\n#import \u003cCocoa/Cocoa.h\u003e\n#include \u003cpthread.h\u003e\n#include \u003cstdint.h\u003e\n#include \u003cstdlib.h\u003e\n\nvoid startDriver();\nvoid stopDriver();\nvoid makeCurrentContext(uintptr_t ctx);\nvoid flushContext(uintptr_t ctx);\nuintptr_t doNewWindow(int width, int height, char* title);\nvoid doShowWindow(uintptr_t id);\nvoid doCloseWindow(uintptr_t id);\nuint64_t threadID();\n*/\nimport \"C\"\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"runtime\"\n\t\"unsafe\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/lifecycler\"\n\t\"golang.org/x/exp/shiny/screen\"\n\t\"golang.org/x/mobile/event/key\"\n\t\"golang.org/x/mobile/event/mouse\"\n\t\"golang.org/x/mobile/event/paint\"\n\t\"golang.org/x/mobile/event/size\"\n\t\"golang.org/x/mobile/geom\"\n\t\"golang.org/x/mobile/gl\"\n)\n\nconst useLifecycler = true\n\n// TODO: change this to true, after manual testing on OS X.\nconst handleSizeEventsAtChannelReceive = false\n\nvar initThreadID C.uint64_t\n\nfunc init() {\n\t// Lock the goroutine responsible for initialization to an OS thread.\n\t// This means the goroutine running main (and calling startDriver below)\n\t// is locked to the OS thread that started the program. This is\n\t// necessary for the correct delivery of Cocoa events to the process.\n\t//\n\t// A discussion on this topic:\n\t// https://groups.google.com/forum/#!msg/golang-nuts/IiWZ2hUuLDA/SNKYYZBelsYJ\n\truntime.LockOSThread()\n\tinitThreadID = C.threadID()\n}\n\nfunc newWindow(opts *screen.NewWindowOptions) (uintptr, error) {\n\twidth, height := optsSize(opts)\n\n\ttitle := C.CString(opts.GetTitle())\n\tdefer C.free(unsafe.Pointer(title))\n\n\treturn uintptr(C.doNewWindow(C.int(width), C.int(height), title)), nil\n}\n\nfunc initWindow(w *windowImpl) {\n\tw.glctx, w.worker = gl.NewContext()\n}\n\nfunc showWindow(w *windowImpl) {\n\tC.doShowWindow(C.uintptr_t(w.id))\n}\n\n//export preparedOpenGL\nfunc preparedOpenGL(id, ctx, vba uintptr) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tw.ctx = ctx\n\tgo drawLoop(w, vba)\n}\n\nfunc closeWindow(id uintptr) {\n\tC.doCloseWindow(C.uintptr_t(id))\n}\n\nvar mainCallback func(screen.Screen)\n\nfunc main(f func(screen.Screen)) error {\n\tif tid := C.threadID(); tid != initThreadID {\n\t\tlog.Fatalf(\"gldriver.Main called on thread %d, but gldriver.init ran on %d\", tid, initThreadID)\n\t}\n\n\tmainCallback = f\n\tC.startDriver()\n\treturn nil\n}\n\n//export driverStarted\nfunc driverStarted() {\n\tgo func() {\n\t\tmainCallback(theScreen)\n\t\tC.stopDriver()\n\t}()\n}\n\n//export drawgl\nfunc drawgl(id uintptr) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn // closing window\n\t}\n\n\t// TODO: is this necessary?\n\tw.lifecycler.SetVisible(true)\n\tw.lifecycler.SendEvent(w, w.glctx)\n\n\tw.Send(paint.Event{External: true})\n\t\u003c-w.drawDone\n}\n\n// drawLoop is the primary drawing loop.\n//\n// After Cocoa has created an NSWindow and called prepareOpenGL,\n// it starts drawLoop on a locked goroutine to handle OpenGL calls.\n//\n// The screen is drawn every time a paint.Event is received, which can be\n// triggered either by the user or by Cocoa via drawgl (for example, when\n// the window is resized).\nfunc drawLoop(w *windowImpl, vba uintptr) {\n\truntime.LockOSThread()\n\tC.makeCurrentContext(C.uintptr_t(w.ctx.(uintptr)))\n\n\t// Starting in OS X 10.11 (El Capitan), the vertex array is\n\t// occasionally getting unbound when the context changes threads.\n\t//\n\t// Avoid this by binding it again.\n\tC.glBindVertexArray(C.GLuint(vba))\n\tif errno := C.glGetError(); errno != 0 {\n\t\tpanic(fmt.Sprintf(\"gldriver: glBindVertexArray failed: %d\", errno))\n\t}\n\n\tworkAvailable := w.worker.WorkAvailable()\n\n\t// TODO(crawshaw): exit this goroutine on Release.\n\tfor {\n\t\tselect {\n\t\tcase \u003c-workAvailable:\n\t\t\tw.worker.DoWork()\n\t\tcase \u003c-w.publish:\n\t\tloop:\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase \u003c-workAvailable:\n\t\t\t\t\tw.worker.DoWork()\n\t\t\t\tdefault:\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\t\t\t}\n\t\t\tC.flushContext(C.uintptr_t(w.ctx.(uintptr)))\n\t\t\tw.publishDone \u003c- screen.PublishResult{}\n\t\t}\n\t}\n}\n\n//export setGeom\nfunc setGeom(id uintptr, ppp float32, widthPx, heightPx int) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn // closing window\n\t}\n\n\tsz := size.Event{\n\t\tWidthPx: widthPx,\n\t\tHeightPx: heightPx,\n\t\tWidthPt: geom.Pt(float32(widthPx) / ppp),\n\t\tHeightPt: geom.Pt(float32(heightPx) / ppp),\n\t\tPixelsPerPt: ppp,\n\t}\n\n\tif !handleSizeEventsAtChannelReceive {\n\t\tw.szMu.Lock()\n\t\tw.sz = sz\n\t\tw.szMu.Unlock()\n\t}\n\n\tw.Send(sz)\n}\n\n//export windowClosing\nfunc windowClosing(id uintptr) {\n\tsendLifecycle(id, (*lifecycler.State).SetDead, true)\n}\n\nfunc sendWindowEvent(id uintptr, e interface{}) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn // closing window\n\t}\n\tw.Send(e)\n}\n\nvar mods = [...]struct {\n\tflags uint32\n\tcode uint16\n\tmod key.Modifiers\n}{\n\t// Left and right variants of modifier keys have their own masks,\n\t// but they are not documented. These were determined empirically.\n\t{1\u003c\u003c17 | 0x102, C.kVK_Shift, key.ModShift},\n\t{1\u003c\u003c17 | 0x104, C.kVK_RightShift, key.ModShift},\n\t{1\u003c\u003c18 | 0x101, C.kVK_Control, key.ModControl},\n\t{33\u003c\u003c13 | 0x100, C.kVK_RightControl, key.ModControl},\n\t{1\u003c\u003c19 | 0x120, C.kVK_Option, key.ModAlt},\n\t{1\u003c\u003c19 | 0x140, C.kVK_RightOption, key.ModAlt},\n\t{1\u003c\u003c20 | 0x108, C.kVK_Command, key.ModMeta},\n\t{1\u003c\u003c20 | 0x110, 0x36 /* kVK_RightCommand */, key.ModMeta},\n}\n\nfunc cocoaMods(flags uint32) (m key.Modifiers) {\n\tfor _, mod := range mods {\n\t\tif flags\u0026mod.flags == mod.flags {\n\t\t\tm |= mod.mod\n\t\t}\n\t}\n\treturn m\n}\n\nfunc cocoaMouseDir(ty int32) mouse.Direction {\n\tswitch ty {\n\tcase C.NSLeftMouseDown, C.NSRightMouseDown, C.NSOtherMouseDown:\n\t\treturn mouse.DirPress\n\tcase C.NSLeftMouseUp, C.NSRightMouseUp, C.NSOtherMouseUp:\n\t\treturn mouse.DirRelease\n\tdefault: // dragged\n\t\treturn mouse.DirNone\n\t}\n}\n\nfunc cocoaMouseButton(button int32) mouse.Button {\n\tswitch button {\n\tcase 0:\n\t\treturn mouse.ButtonLeft\n\tcase 1:\n\t\treturn mouse.ButtonRight\n\tcase 2:\n\t\treturn mouse.ButtonMiddle\n\tdefault:\n\t\treturn mouse.ButtonNone\n\t}\n}\n\n//export mouseEvent\nfunc mouseEvent(id uintptr, x, y, dx, dy float32, ty, button int32, flags uint32) {\n\tcmButton := mouse.ButtonNone\n\tswitch ty {\n\tdefault:\n\t\tcmButton = cocoaMouseButton(button)\n\tcase C.NSMouseMoved, C.NSLeftMouseDragged, C.NSRightMouseDragged, C.NSOtherMouseDragged:\n\t\t// No-op.\n\tcase C.NSScrollWheel:\n\t\t// Note that the direction of scrolling is inverted by default\n\t\t// on OS X by the \"natural scrolling\" setting. At the Cocoa\n\t\t// level this inversion is applied to trackpads and mice behind\n\t\t// the scenes, and the value of dy goes in the direction the OS\n\t\t// wants scrolling to go.\n\t\t//\n\t\t// This means the same trackpad/mouse motion on OS X and Linux\n\t\t// can produce wheel events in opposite directions, but the\n\t\t// direction matches what other programs on the OS do.\n\t\t//\n\t\t// If we wanted to expose the physical device motion in the\n\t\t// event we could use [NSEvent isDirectionInvertedFromDevice]\n\t\t// to know if \"natural scrolling\" is enabled.\n\t\t//\n\t\t// TODO: On a trackpad, a scroll can be a drawn-out affair with a\n\t\t// distinct beginning and end. Should the intermediate events be\n\t\t// DirNone?\n\t\t//\n\t\t// TODO: handle horizontal scrolling\n\t\tbutton := mouse.ButtonWheelUp\n\t\tif dy \u003c 0 {\n\t\t\tdy = -dy\n\t\t\tbutton = mouse.ButtonWheelDown\n\t\t}\n\t\te := mouse.Event{\n\t\t\tX: x,\n\t\t\tY: y,\n\t\t\tButton: button,\n\t\t\tDirection: mouse.DirStep,\n\t\t\tModifiers: cocoaMods(flags),\n\t\t}\n\t\tfor delta := int(dy); delta != 0; delta-- {\n\t\t\tsendWindowEvent(id, e)\n\t\t}\n\t\treturn\n\t}\n\tsendWindowEvent(id, mouse.Event{\n\t\tX: x,\n\t\tY: y,\n\t\tButton: cmButton,\n\t\tDirection: cocoaMouseDir(ty),\n\t\tModifiers: cocoaMods(flags),\n\t})\n}\n\n//export keyEvent\nfunc keyEvent(id uintptr, runeVal rune, dir uint8, code uint16, flags uint32) {\n\tsendWindowEvent(id, key.Event{\n\t\tRune: cocoaRune(runeVal),\n\t\tDirection: key.Direction(dir),\n\t\tCode: cocoaKeyCode(code),\n\t\tModifiers: cocoaMods(flags),\n\t})\n}\n\n//export flagEvent\nfunc flagEvent(id uintptr, flags uint32) {\n\tfor _, mod := range mods {\n\t\tif flags\u0026mod.flags == mod.flags \u0026\u0026 lastFlags\u0026mod.flags != mod.flags {\n\t\t\tkeyEvent(id, -1, C.NSKeyDown, mod.code, flags)\n\t\t}\n\t\tif lastFlags\u0026mod.flags == mod.flags \u0026\u0026 flags\u0026mod.flags != mod.flags {\n\t\t\tkeyEvent(id, -1, C.NSKeyUp, mod.code, flags)\n\t\t}\n\t}\n\tlastFlags = flags\n}\n\nvar lastFlags uint32\n\nfunc sendLifecycle(id uintptr, setter func(*lifecycler.State, bool), val bool) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[id]\n\ttheScreen.mu.Unlock()\n\n\tif w == nil {\n\t\treturn\n\t}\n\tsetter(\u0026w.lifecycler, val)\n\tw.lifecycler.SendEvent(w, w.glctx)\n}\n\nfunc sendLifecycleAll(dead bool) {\n\twindows := []*windowImpl{}\n\n\ttheScreen.mu.Lock()\n\tfor _, w := range theScreen.windows {\n\t\twindows = append(windows, w)\n\t}\n\ttheScreen.mu.Unlock()\n\n\tfor _, w := range windows {\n\t\tw.lifecycler.SetFocused(false)\n\t\tw.lifecycler.SetVisible(false)\n\t\tif dead {\n\t\t\tw.lifecycler.SetDead(true)\n\t\t}\n\t\tw.lifecycler.SendEvent(w, w.glctx)\n\t}\n}\n\n//export lifecycleDeadAll\nfunc lifecycleDeadAll() { sendLifecycleAll(true) }\n\n//export lifecycleHideAll\nfunc lifecycleHideAll() { sendLifecycleAll(false) }\n\n//export lifecycleVisible\nfunc lifecycleVisible(id uintptr, val bool) {\n\tsendLifecycle(id, (*lifecycler.State).SetVisible, val)\n}\n\n//export lifecycleFocused\nfunc lifecycleFocused(id uintptr, val bool) {\n\tsendLifecycle(id, (*lifecycler.State).SetFocused, val)\n}\n\n// cocoaRune marks the Carbon/Cocoa private-range unicode rune representing\n// a non-unicode key event to -1, used for Rune in the key package.\n//\n// http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/CORPCHAR.TXT\nfunc cocoaRune(r rune) rune {\n\tif ''\\uE000'' \u003c= r \u0026\u0026 r \u003c= ''\\uF8FF'' {\n\t\treturn -1\n\t}\n\treturn r\n}\n\n// cocoaKeyCode converts a Carbon/Cocoa virtual key code number\n// into the standard keycodes used by the key package.\n//\n// To get a sense of the key map, see the diagram on\n//\n//\thttp://boredzo.org/blog/archives/2007-05-22/virtual-key-codes\nfunc cocoaKeyCode(vkcode uint16) key.Code {\n\tswitch vkcode {\n\tcase C.kVK_ANSI_A:\n\t\treturn key.CodeA\n\tcase C.kVK_ANSI_B:\n\t\treturn key.CodeB\n\tcase C.kVK_ANSI_C:\n\t\treturn key.CodeC\n\tcase C.kVK_ANSI_D:\n\t\treturn key.CodeD\n\tcase C.kVK_ANSI_E:\n\t\treturn key.CodeE\n\tcase C.kVK_ANSI_F:\n\t\treturn key.CodeF\n\tcase C.kVK_ANSI_G:\n\t\treturn key.CodeG\n\tcase C.kVK_ANSI_H:\n\t\treturn key.CodeH\n\tcase C.kVK_ANSI_I:\n\t\treturn key.CodeI\n\tcase C.kVK_ANSI_J:\n\t\treturn key.CodeJ\n\tcase C.kVK_ANSI_K:\n\t\treturn key.CodeK\n\tcase C.kVK_ANSI_L:\n\t\treturn key.CodeL\n\tcase C.kVK_ANSI_M:\n\t\treturn key.CodeM\n\tcase C.kVK_ANSI_N:\n\t\treturn key.CodeN\n\tcase C.kVK_ANSI_O:\n\t\treturn key.CodeO\n\tcase C.kVK_ANSI_P:\n\t\treturn key.CodeP\n\tcase C.kVK_ANSI_Q:\n\t\treturn key.CodeQ\n\tcase C.kVK_ANSI_R:\n\t\treturn key.CodeR\n\tcase C.kVK_ANSI_S:\n\t\treturn key.CodeS\n\tcase C.kVK_ANSI_T:\n\t\treturn key.CodeT\n\tcase C.kVK_ANSI_U:\n\t\treturn key.CodeU\n\tcase C.kVK_ANSI_V:\n\t\treturn key.CodeV\n\tcase C.kVK_ANSI_W:\n\t\treturn key.CodeW\n\tcase C.kVK_ANSI_X:\n\t\treturn key.CodeX\n\tcase C.kVK_ANSI_Y:\n\t\treturn key.CodeY\n\tcase C.kVK_ANSI_Z:\n\t\treturn key.CodeZ\n\tcase C.kVK_ANSI_1:\n\t\treturn key.Code1\n\tcase C.kVK_ANSI_2:\n\t\treturn key.Code2\n\tcase C.kVK_ANSI_3:\n\t\treturn key.Code3\n\tcase C.kVK_ANSI_4:\n\t\treturn key.Code4\n\tcase C.kVK_ANSI_5:\n\t\treturn key.Code5\n\tcase C.kVK_ANSI_6:\n\t\treturn key.Code6\n\tcase C.kVK_ANSI_7:\n\t\treturn key.Code7\n\tcase C.kVK_ANSI_8:\n\t\treturn key.Code8\n\tcase C.kVK_ANSI_9:\n\t\treturn key.Code9\n\tcase C.kVK_ANSI_0:\n\t\treturn key.Code0\n\t// TODO: move the rest of these codes to constants in key.go\n\t// if we are happy with them.\n\tcase C.kVK_Return:\n\t\treturn key.CodeReturnEnter\n\tcase C.kVK_Escape:\n\t\treturn key.CodeEscape\n\tcase C.kVK_Delete:\n\t\treturn key.CodeDeleteBackspace\n\tcase C.kVK_Tab:\n\t\treturn key.CodeTab\n\tcase C.kVK_Space:\n\t\treturn key.CodeSpacebar\n\tcase C.kVK_ANSI_Minus:\n\t\treturn key.CodeHyphenMinus\n\tcase C.kVK_ANSI_Equal:\n\t\treturn key.CodeEqualSign\n\tcase C.kVK_ANSI_LeftBracket:\n\t\treturn key.CodeLeftSquareBracket\n\tcase C.kVK_ANSI_RightBracket:\n\t\treturn key.CodeRightSquareBracket\n\tcase C.kVK_ANSI_Backslash:\n\t\treturn key.CodeBackslash\n\t// 50: Keyboard Non-US \"#\" and ~\n\tcase C.kVK_ANSI_Semicolon:\n\t\treturn key.CodeSemicolon\n\tcase C.kVK_ANSI_Quote:\n\t\treturn key.CodeApostrophe\n\tcase C.kVK_ANSI_Grave:\n\t\treturn key.CodeGraveAccent\n\tcase C.kVK_ANSI_Comma:\n\t\treturn key.CodeComma\n\tcase C.kVK_ANSI_Period:\n\t\treturn key.CodeFullStop\n\tcase C.kVK_ANSI_Slash:\n\t\treturn key.CodeSlash\n\tcase C.kVK_CapsLock:\n\t\treturn key.CodeCapsLock\n\tcase C.kVK_F1:\n\t\treturn key.CodeF1\n\tcase C.kVK_F2:\n\t\treturn key.CodeF2\n\tcase C.kVK_F3:\n\t\treturn key.CodeF3\n\tcase C.kVK_F4:\n\t\treturn key.CodeF4\n\tcase C.kVK_F5:\n\t\treturn key.CodeF5\n\tcase C.kVK_F6:\n\t\treturn key.CodeF6\n\tcase C.kVK_F7:\n\t\treturn key.CodeF7\n\tcase C.kVK_F8:\n\t\treturn key.CodeF8\n\tcase C.kVK_F9:\n\t\treturn key.CodeF9\n\tcase C.kVK_F10:\n\t\treturn key.CodeF10\n\tcase C.kVK_F11:\n\t\treturn key.CodeF11\n\tcase C.kVK_F12:\n\t\treturn key.CodeF12\n\t// 70: PrintScreen\n\t// 71: Scroll Lock\n\t// 72: Pause\n\t// 73: Insert\n\tcase C.kVK_Home:\n\t\treturn key.CodeHome\n\tcase C.kVK_PageUp:\n\t\treturn key.CodePageUp\n\tcase C.kVK_ForwardDelete:\n\t\treturn key.CodeDeleteForward\n\tcase C.kVK_End:\n\t\treturn key.CodeEnd\n\tcase C.kVK_PageDown:\n\t\treturn key.CodePageDown\n\tcase C.kVK_RightArrow:\n\t\treturn key.CodeRightArrow\n\tcase C.kVK_LeftArrow:\n\t\treturn key.CodeLeftArrow\n\tcase C.kVK_DownArrow:\n\t\treturn key.CodeDownArrow\n\tcase C.kVK_UpArrow:\n\t\treturn key.CodeUpArrow\n\tcase C.kVK_ANSI_KeypadClear:\n\t\treturn key.CodeKeypadNumLock\n\tcase C.kVK_ANSI_KeypadDivide:\n\t\treturn key.CodeKeypadSlash\n\tcase C.kVK_ANSI_KeypadMultiply:\n\t\treturn key.CodeKeypadAsterisk\n\tcase C.kVK_ANSI_KeypadMinus:\n\t\treturn key.CodeKeypadHyphenMinus\n\tcase C.kVK_ANSI_KeypadPlus:\n\t\treturn key.CodeKeypadPlusSign\n\tcase C.kVK_ANSI_KeypadEnter:\n\t\treturn key.CodeKeypadEnter\n\tcase C.kVK_ANSI_Keypad1:\n\t\treturn key.CodeKeypad1\n\tcase C.kVK_ANSI_Keypad2:\n\t\treturn key.CodeKeypad2\n\tcase C.kVK_ANSI_Keypad3:\n\t\treturn key.CodeKeypad3\n\tcase C.kVK_ANSI_Keypad4:\n\t\treturn key.CodeKeypad4\n\tcase C.kVK_ANSI_Keypad5:\n\t\treturn key.CodeKeypad5\n\tcase C.kVK_ANSI_Keypad6:\n\t\treturn key.CodeKeypad6\n\tcase C.kVK_ANSI_Keypad7:\n\t\treturn key.CodeKeypad7\n\tcase C.kVK_ANSI_Keypad8:\n\t\treturn key.CodeKeypad8\n\tcase C.kVK_ANSI_Keypad9:\n\t\treturn key.CodeKeypad9\n\tcase C.kVK_ANSI_Keypad0:\n\t\treturn key.CodeKeypad0\n\tcase C.kVK_ANSI_KeypadDecimal:\n\t\treturn key.CodeKeypadFullStop\n\tcase C.kVK_ANSI_KeypadEquals:\n\t\treturn key.CodeKeypadEqualSign\n\tcase C.kVK_F13:\n\t\treturn key.CodeF13\n\tcase C.kVK_F14:\n\t\treturn key.CodeF14\n\tcase C.kVK_F15:\n\t\treturn key.CodeF15\n\tcase C.kVK_F16:\n\t\treturn key.CodeF16\n\tcase C.kVK_F17:\n\t\treturn key.CodeF17\n\tcase C.kVK_F18:\n\t\treturn key.CodeF18\n\tcase C.kVK_F19:\n\t\treturn key.CodeF19\n\tcase C.kVK_F20:\n\t\treturn key.CodeF20\n\t// 116: Keyboard Execute\n\tcase C.kVK_Help:\n\t\treturn key.CodeHelp\n\t// 118: Keyboard Menu\n\t// 119: Keyboard Select\n\t// 120: Keyboard Stop\n\t// 121: Keyboard Again\n\t// 122: Keyboard Undo\n\t// 123: Keyboard Cut\n\t// 124: Keyboard Copy\n\t// 125: Keyboard Paste\n\t// 126: Keyboard Find\n\tcase C.kVK_Mute:\n\t\treturn key.CodeMute\n\tcase C.kVK_VolumeUp:\n\t\treturn key.CodeVolumeUp\n\tcase C.kVK_VolumeDown:\n\t\treturn key.CodeVolumeDown\n\t// 130: Keyboard Locking Caps Lock\n\t// 131: Keyboard Locking Num Lock\n\t// 132: Keyboard Locking Scroll Lock\n\t// 133: Keyboard Comma\n\t// 134: Keyboard Equal Sign\n\t// ...: Bunch of stuff\n\tcase C.kVK_Control:\n\t\treturn key.CodeLeftControl\n\tcase C.kVK_Shift:\n\t\treturn key.CodeLeftShift\n\tcase C.kVK_Option:\n\t\treturn key.CodeLeftAlt\n\tcase C.kVK_Command:\n\t\treturn key.CodeLeftGUI\n\tcase C.kVK_RightControl:\n\t\treturn key.CodeRightControl\n\tcase C.kVK_RightShift:\n\t\treturn key.CodeRightShift\n\tcase C.kVK_RightOption:\n\t\treturn key.CodeRightAlt\n\t// TODO key.CodeRightGUI\n\tdefault:\n\t\treturn key.CodeUnknown\n\t}\n}\n\nfunc surfaceCreate() error {\n\treturn errors.New(\"gldriver: surface creation not implemented on darwin\")\n}\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) error {","lineNumber":98,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/gldriver/win32.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/win32.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build windows\n\npackage gldriver\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"runtime\"\n\t\"syscall\"\n\t\"unsafe\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/win32\"\n\t\"golang.org/x/exp/shiny/screen\"\n\t\"golang.org/x/mobile/event/key\"\n\t\"golang.org/x/mobile/event/lifecycle\"\n\t\"golang.org/x/mobile/event/mouse\"\n\t\"golang.org/x/mobile/event/paint\"\n\t\"golang.org/x/mobile/event/size\"\n\t\"golang.org/x/mobile/gl\"\n)\n\n// TODO: change this to true, after manual testing on Win32.\nconst useLifecycler = false\n\n// TODO: change this to true, after manual testing on Win32.\nconst handleSizeEventsAtChannelReceive = false\n\nfunc main(f func(screen.Screen)) error {\n\treturn win32.Main(func() { f(theScreen) })\n}\n\nvar (\n\teglGetPlatformDisplayEXT = gl.LibEGL.NewProc(\"eglGetPlatformDisplayEXT\")\n\teglInitialize = gl.LibEGL.NewProc(\"eglInitialize\")\n\teglChooseConfig = gl.LibEGL.NewProc(\"eglChooseConfig\")\n\teglGetError = gl.LibEGL.NewProc(\"eglGetError\")\n\teglBindAPI = gl.LibEGL.NewProc(\"eglBindAPI\")\n\teglCreateWindowSurface = gl.LibEGL.NewProc(\"eglCreateWindowSurface\")\n\teglCreateContext = gl.LibEGL.NewProc(\"eglCreateContext\")\n\teglMakeCurrent = gl.LibEGL.NewProc(\"eglMakeCurrent\")\n\teglSwapInterval = gl.LibEGL.NewProc(\"eglSwapInterval\")\n\teglDestroySurface = gl.LibEGL.NewProc(\"eglDestroySurface\")\n\teglSwapBuffers = gl.LibEGL.NewProc(\"eglSwapBuffers\")\n)\n\ntype eglConfig uintptr // void*\n\ntype eglInt int32\n\nvar rgb888 = [...]eglInt{\n\t_EGL_RENDERABLE_TYPE, _EGL_OPENGL_ES2_BIT,\n\t_EGL_SURFACE_TYPE, _EGL_WINDOW_BIT,\n\t_EGL_BLUE_SIZE, 8,\n\t_EGL_GREEN_SIZE, 8,\n\t_EGL_RED_SIZE, 8,\n\t_EGL_DEPTH_SIZE, 16,\n\t_EGL_STENCIL_SIZE, 8,\n\t_EGL_NONE,\n}\n\ntype ctxWin32 struct {\n\tctx uintptr\n\tdisplay uintptr // EGLDisplay\n\tsurface uintptr // EGLSurface\n}\n\nfunc newWindow(opts *screen.NewWindowOptions) (uintptr, error) {\n\tw, err := win32.NewWindow(opts)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uintptr(w), nil\n}\n\nfunc initWindow(w *windowImpl) {\n\tw.glctx, w.worker = gl.NewContext()\n}\n\nfunc showWindow(w *windowImpl) {\n\t// Show makes an initial call to sizeEvent (via win32.SizeEvent), where\n\t// we setup the EGL surface and GL context.\n\twin32.Show(syscall.Handle(w.id))\n}\n\nfunc closeWindow(id uintptr) {} // TODO\n\nfunc drawLoop(w *windowImpl) {\n\truntime.LockOSThread()\n\n\tdisplay := w.ctx.(ctxWin32).display\n\tsurface := w.ctx.(ctxWin32).surface\n\tctx := w.ctx.(ctxWin32).ctx\n\n\tif ret, _, _ := eglMakeCurrent.Call(display, surface, surface, ctx); ret == 0 {\n\t\tpanic(fmt.Sprintf(\"eglMakeCurrent failed: %v\", eglErr()))\n\t}\n\n\t// TODO(crawshaw): exit this goroutine on Release.\n\tworkAvailable := w.worker.WorkAvailable()\n\tfor {\n\t\tselect {\n\t\tcase \u003c-workAvailable:\n\t\t\tw.worker.DoWork()\n\t\tcase \u003c-w.publish:\n\t\tloop:\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase \u003c-workAvailable:\n\t\t\t\t\tw.worker.DoWork()\n\t\t\t\tdefault:\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ret, _, _ := eglSwapBuffers.Call(display, surface); ret == 0 {\n\t\t\t\tpanic(fmt.Sprintf(\"eglSwapBuffers failed: %v\", eglErr()))\n\t\t\t}\n\t\t\tw.publishDone \u003c- screen.PublishResult{}\n\t\t}\n\t}\n}\n\nfunc init() {\n\twin32.SizeEvent = sizeEvent\n\twin32.PaintEvent = paintEvent\n\twin32.MouseEvent = mouseEvent\n\twin32.KeyEvent = keyEvent\n\twin32.LifecycleEvent = lifecycleEvent\n}\n\nfunc lifecycleEvent(hwnd syscall.Handle, to lifecycle.Stage) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[uintptr(hwnd)]\n\ttheScreen.mu.Unlock()\n\n\tif w.lifecycleStage == to {\n\t\treturn\n\t}\n\tw.Send(lifecycle.Event{\n\t\tFrom: w.lifecycleStage,\n\t\tTo: to,\n\t\tDrawContext: w.glctx,\n\t})\n\tw.lifecycleStage = to\n}\n\nfunc mouseEvent(hwnd syscall.Handle, e mouse.Event) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[uintptr(hwnd)]\n\ttheScreen.mu.Unlock()\n\n\tw.Send(e)\n}\n\nfunc keyEvent(hwnd syscall.Handle, e key.Event) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[uintptr(hwnd)]\n\ttheScreen.mu.Unlock()\n\n\tw.Send(e)\n}\n\nfunc paintEvent(hwnd syscall.Handle, e paint.Event) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[uintptr(hwnd)]\n\ttheScreen.mu.Unlock()\n\n\tif w.ctx == nil {\n\t\t// Sometimes a paint event comes in before initial\n\t\t// window size is set. Ignore it.\n\t\treturn\n\t}\n\n\t// TODO: the paint.Event should have External: true.\n\tw.Send(paint.Event{})\n}\n\nfunc sizeEvent(hwnd syscall.Handle, e size.Event) {\n\ttheScreen.mu.Lock()\n\tw := theScreen.windows[uintptr(hwnd)]\n\ttheScreen.mu.Unlock()\n\n\tif w.ctx == nil {\n\t\t// This is the initial size event on window creation.\n\t\t// Create an EGL surface and spin up a GL context.\n\t\tif err := createEGLSurface(hwnd, w); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tgo drawLoop(w)\n\t}\n\n\tif !handleSizeEventsAtChannelReceive {\n\t\tw.szMu.Lock()\n\t\tw.sz = e\n\t\tw.szMu.Unlock()\n\t}\n\n\tw.Send(e)\n\n\tif handleSizeEventsAtChannelReceive {\n\t\treturn\n\t}\n\n\t// Screen is dirty, generate a paint event.\n\t//\n\t// The sizeEvent function is called on the goroutine responsible for\n\t// calling the GL worker.DoWork. When compiling with -tags gldebug,\n\t// these GL calls are blocking (so we can read the error message), so\n\t// to make progress they need to happen on another goroutine.\n\tgo func() {\n\t\t// TODO: this call to Viewport is not right, but is very hard to\n\t\t// do correctly with our async events channel model. We want\n\t\t// the call to Viewport to be made the instant before the\n\t\t// paint.Event is received.\n\t\tw.glctxMu.Lock()\n\t\tw.glctx.Viewport(0, 0, e.WidthPx, e.HeightPx)\n\t\tw.glctx.ClearColor(0, 0, 0, 1)\n\t\tw.glctx.Clear(gl.COLOR_BUFFER_BIT)\n\t\tw.glctxMu.Unlock()\n\n\t\tw.Send(paint.Event{})\n\t}()\n}\n\nfunc eglErr() error {\n\tif ret, _, _ := eglGetError.Call(); ret != _EGL_SUCCESS {\n\t\treturn errors.New(eglErrString(ret))\n\t}\n\treturn nil\n}\n\nfunc createEGLSurface(hwnd syscall.Handle, w *windowImpl) error {\n\tvar displayAttribPlatforms = [][]eglInt{\n\t\t// Default\n\t\t[]eglInt{\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_NONE,\n\t\t},\n\t\t// Direct3D 11\n\t\t[]eglInt{\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_NONE,\n\t\t},\n\t\t// Direct3D 9\n\t\t[]eglInt{\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_NONE,\n\t\t},\n\t\t// Direct3D 11 with WARP\n\t\t// https://msdn.microsoft.com/en-us/library/windows/desktop/gg615082.aspx\n\t\t[]eglInt{\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, _EGL_DONT_CARE,\n\t\t\t_EGL_NONE,\n\t\t},\n\t}\n\n\tdc, err := win32.GetDC(hwnd)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"win32.GetDC failed: %v\", err)\n\t}\n\n\tvar display uintptr = _EGL_NO_DISPLAY\n\tfor i, displayAttrib := range displayAttribPlatforms {\n\t\tlastTry := i == len(displayAttribPlatforms)-1\n\n\t\tdisplay, _, _ = eglGetPlatformDisplayEXT.Call(\n\t\t\t_EGL_PLATFORM_ANGLE_ANGLE,\n\t\t\tuintptr(dc),\n\t\t\tuintptr(unsafe.Pointer(\u0026displayAttrib[0])),\n\t\t)\n\n\t\tif display == _EGL_NO_DISPLAY {\n\t\t\tif !lastTry {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"eglGetPlatformDisplayEXT failed: %v\", eglErr())\n\t\t}\n\n\t\tif ret, _, _ := eglInitialize.Call(display, 0, 0); ret == 0 {\n\t\t\tif !lastTry {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"eglInitialize failed: %v\", eglErr())\n\t\t}\n\t}\n\n\teglBindAPI.Call(_EGL_OPENGL_ES_API)\n\tif err := eglErr(); err != nil {\n\t\treturn err\n\t}\n\n\tvar numConfigs eglInt\n\tvar config eglConfig\n\tret, _, _ := eglChooseConfig.Call(\n\t\tdisplay,\n\t\tuintptr(unsafe.Pointer(\u0026rgb888[0])),\n\t\tuintptr(unsafe.Pointer(\u0026config)),\n\t\t1,\n\t\tuintptr(unsafe.Pointer(\u0026numConfigs)),\n\t)\n\tif ret == 0 {\n\t\treturn fmt.Errorf(\"eglChooseConfig failed: %v\", eglErr())\n\t}\n\tif numConfigs \u003c= 0 {\n\t\treturn errors.New(\"eglChooseConfig found no valid config\")\n\t}\n\n\tsurface, _, _ := eglCreateWindowSurface.Call(display, uintptr(config), uintptr(hwnd), 0, 0)\n\tif surface == _EGL_NO_SURFACE {\n\t\treturn fmt.Errorf(\"eglCreateWindowSurface failed: %v\", eglErr())\n\t}\n\n\tcontextAttribs := [...]eglInt{\n\t\t_EGL_CONTEXT_CLIENT_VERSION, 2,\n\t\t_EGL_NONE,\n\t}\n\tcontext, _, _ := eglCreateContext.Call(\n\t\tdisplay,\n\t\tuintptr(config),\n\t\t_EGL_NO_CONTEXT,\n\t\tuintptr(unsafe.Pointer(\u0026contextAttribs[0])),\n\t)\n\tif context == _EGL_NO_CONTEXT {\n\t\treturn fmt.Errorf(\"eglCreateContext failed: %v\", eglErr())\n\t}\n\n\teglSwapInterval.Call(display, 1)\n\n\tw.ctx = ctxWin32{\n\t\tctx: context,\n\t\tdisplay: display,\n\t\tsurface: surface,\n\t}\n\n\treturn nil\n}\n\nfunc surfaceCreate() error {\n\treturn errors.New(\"gldriver: surface creation not implemented on windows\")\n}\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) error {","lineNumber":31,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/gldriver/other.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/other.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build (!darwin || ios || !cgo) \u0026\u0026 (!linux || android || !cgo) \u0026\u0026 (!openbsd || !cgo) \u0026\u0026 !windows\n\npackage gldriver\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\nconst useLifecycler = true\nconst handleSizeEventsAtChannelReceive = true\n\nvar errUnsupported = fmt.Errorf(\"gldriver: unsupported GOOS/GOARCH %s/%s or cgo not enabled\", runtime.GOOS, runtime.GOARCH)\n\nfunc newWindow(opts *screen.NewWindowOptions) (uintptr, error) { return 0, errUnsupported }\n\nfunc initWindow(id *windowImpl) {}\nfunc showWindow(id *windowImpl) {}\nfunc closeWindow(id uintptr) {}\nfunc drawLoop(w *windowImpl) {}\n\nfunc surfaceCreate() error { return errUnsupported }\nfunc main(f func(screen.Screen)) error { return errUnsupported }\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) error { return errUnsupported }","lineNumber":28,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/driver_windows.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_windows.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage driver\n\nimport (\n\t\"golang.org/x/exp/shiny/driver/windriver\"\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\nfunc main(f func(screen.Screen)) {\n\twindriver.Main(f)\n}\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) {","lineNumber":11,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/driver_fallback.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_fallback.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build !darwin \u0026\u0026 (!linux || android) \u0026\u0026 !windows \u0026\u0026 !dragonfly \u0026\u0026 !openbsd\n\npackage driver\n\nimport (\n\t\"errors\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/errscreen\"\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\nfunc main(f func(screen.Screen)) {\n\tf(errscreen.Stub(errors.New(\"no driver for accessing a screen\")))\n}\n"},"lineMatches":[{"preview":"func main(f func(screen.Screen)) {","lineNumber":15,"offsetAndLengths":[[0,10]]}]}]}}}}' - headers: - Content-Type: - - application/json - status: 200 OK - code: 200 - duration: 1.299186209s -- id: 5 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 48149 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_eG1GRwBeCLOUWghVcDdwhumF\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"lang:go content:\\\\\\\"func main(\\\\\\\" type:file count:10\\\",\\\"count\\\":10,\\\"timeout\\\":60}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 10 matches across 10 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/yinchengtsinghua/go-ethereum-chinese/cmd/wnode/main.go\\n\\nURL: /github.com/yinchengtsinghua/go-ethereum-chinese/-/blob/cmd/wnode/main.go\\n\\n```\\n106| \\targServerPoW = flag.Float64(\\\"mspow\\\", whisper.DefaultMinimumPoW, \\\"PoW requirement for Mail Server request\\\")\\n107| \\n108| \\targIP = flag.String(\\\"ip\\\", \\\"\\\", \\\"IP address and port of this node (e.g. 127.0.0.1:30303)\\\")\\n109| \\targPub = flag.String(\\\"pub\\\", \\\"\\\", \\\"public key for asymmetric encryption\\\")\\n110| \\targDBPath = flag.String(\\\"dbpath\\\", \\\"\\\", \\\"path to the server's DB directory\\\")\\n111| \\targIDFile = flag.String(\\\"idfile\\\", \\\"\\\", \\\"file name with node id (private key)\\\")\\n112| argEnode = flag.String(\\\"boot\\\", \\\"\\\", \\\"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\\n113| \\targTopic = flag.String(\\\"topic\\\", \\\"\\\", \\\"topic in hexadecimal format (e.g. 70a4beef)\\\")\\n114| \\targSaveDir = flag.String(\\\"savedir\\\", \\\"\\\", \\\"directory where all incoming messages will be saved as files\\\")\\n115| )\\n116| func main() {\\n117| func main() {\\n118| \\tprocessArgs()\\n119| \\tinitialize()\\n120| \\trun()\\n121| \\tshutdown()\\n122| }\\n123| \\n124| func processArgs() {\\n125| \\tflag.Parse()\\n126| \\n```\\n\\n## Result 2: github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/cmd/wnode/main.go\\n\\nURL: /github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/-/blob/cmd/wnode/main.go\\n\\n```\\n106| \\targServerPoW = flag.Float64(\\\"mspow\\\", whisper.DefaultMinimumPoW, \\\"PoW requirement for Mail Server request\\\")\\n107| \\n108| \\targIP = flag.String(\\\"ip\\\", \\\"\\\", \\\"IP address and port of this node (e.g. 127.0.0.1:30303)\\\")\\n109| \\targPub = flag.String(\\\"pub\\\", \\\"\\\", \\\"public key for asymmetric encryption\\\")\\n110| \\targDBPath = flag.String(\\\"dbpath\\\", \\\"\\\", \\\"path to the server's DB directory\\\")\\n111| \\targIDFile = flag.String(\\\"idfile\\\", \\\"\\\", \\\"file name with node id (private key)\\\")\\n112| argEnode = flag.String(\\\"boot\\\", \\\"\\\", \\\"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\\n113| \\targTopic = flag.String(\\\"topic\\\", \\\"\\\", \\\"topic in hexadecimal format (e.g. 70a4beef)\\\")\\n114| \\targSaveDir = flag.String(\\\"savedir\\\", \\\"\\\", \\\"directory where all incoming messages will be saved as files\\\")\\n115| )\\n116| func main() {\\n117| func main() {\\n118| \\tprocessArgs()\\n119| \\tinitialize()\\n120| \\trun()\\n121| \\tshutdown()\\n122| }\\n123| \\n124| func processArgs() {\\n125| \\tflag.Parse()\\n126| \\n```\\n\\n## Result 3: github.com/erigontech/erigon/cmd/evm/internal/t8ntool/transition.go\\n\\nURL: /github.com/erigontech/erigon/-/blob/cmd/evm/internal/t8ntool/transition.go\\n\\n```\\n91| // compile-time conformance test\\n92| var (\\n93| \\t_ cli.ExitCoder = (*NumberedError)(nil)\\n94| )\\n95| \\n96| type input struct {\\n97| \\tAlloc types.GenesisAlloc `json:\\\"alloc,omitempty\\\"`\\n98| \\tEnv *stEnv `json:\\\"env,omitempty\\\"`\\n99| \\tTxs []*txWithKey `json:\\\"txs,omitempty\\\"`\\n100| }\\n101| func Main(ctx *cli.Context) error {\\n102| func Main(ctx *cli.Context) error {\\n103| \\tlog.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StderrHandler))\\n104| \\tvar (\\n105| \\t\\terr error\\n106| \\t\\tbaseDir = \\\"\\\"\\n107| \\t)\\n108| \\tvar getTracer func(txIndex int, txHash common.Hash) (*tracing.Hooks, error)\\n109| \\n110| \\t// If user specified a basedir, make sure it exists\\n111| \\tif ctx.IsSet(OutputBasedir.Name) {\\n```\\n\\n## Result 4: github.com/cilium/hubble/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\nURL: /github.com/cilium/hubble/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\n```\\n18| \\t\\\"io/ioutil\\\"\\n19| \\t\\\"log\\\"\\n20| \\t\\\"os\\\"\\n21| \\n22| \\t\\\"google.golang.org/protobuf/proto\\\"\\n23| \\t\\\"google.golang.org/protobuf/types/known/anypb\\\"\\n24| )\\n25| \\n26| type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\\n27| \\n28| func Main(handler extensionHandler) {\\n29| func Main(handler extensionHandler) {\\n30| \\t// unpack the request\\n31| \\tdata, err := ioutil.ReadAll(os.Stdin)\\n32| \\tif err != nil {\\n33| \\t\\tlog.Println(\\\"File error:\\\", err.Error())\\n34| \\t\\tos.Exit(1)\\n35| \\t}\\n36| \\tif len(data) == 0 {\\n37| \\t\\tlog.Println(\\\"No input data.\\\")\\n38| \\t\\tos.Exit(1)\\n```\\n\\n## Result 5: github.com/eclipse-che/che-operator/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\nURL: /github.com/eclipse-che/che-operator/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\n```\\n18| \\t\\\"io/ioutil\\\"\\n19| \\t\\\"log\\\"\\n20| \\t\\\"os\\\"\\n21| \\n22| \\t\\\"google.golang.org/protobuf/proto\\\"\\n23| \\t\\\"google.golang.org/protobuf/types/known/anypb\\\"\\n24| )\\n25| \\n26| type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\\n27| \\n28| func Main(handler extensionHandler) {\\n29| func Main(handler extensionHandler) {\\n30| \\t// unpack the request\\n31| \\tdata, err := ioutil.ReadAll(os.Stdin)\\n32| \\tif err != nil {\\n33| \\t\\tlog.Println(\\\"File error:\\\", err.Error())\\n34| \\t\\tos.Exit(1)\\n35| \\t}\\n36| \\tif len(data) == 0 {\\n37| \\t\\tlog.Println(\\\"No input data.\\\")\\n38| \\t\\tos.Exit(1)\\n```\\n\\n## Result 6: github.com/wader/fq/pkg/cli/cli.go\\n\\nURL: /github.com/wader/fq/-/blob/pkg/cli/cli.go\\n\\n```\\n253| \\n254| func (o *stdOS) Close() error {\\n255| \\t// only close if is terminal otherwise ansi reset will write\\n256| \\t// to stdout and mess up raw output\\n257| \\tif o.rl != nil {\\n258| \\t\\to.rl.Close()\\n259| \\t}\\n260| \\tclose(o.closeChan)\\n261| \\treturn nil\\n262| }\\n263| func Main(r *interp.Registry, version string) {\\n264| func Main(r *interp.Registry, version string) {\\n265| \\tos.Exit(func() int {\\n266| \\t\\tdefer maybeProfile()()\\n267| \\t\\tmaybeLogFile()\\n268| \\n269| \\t\\tsos := newStandardOS()\\n270| \\t\\tdefer sos.Close()\\n271| \\t\\ti, err := interp.New(sos, r)\\n272| \\t\\tdefer i.Stop()\\n273| \\t\\tif err != nil {\\n```\\n\\n## Result 7: github.com/gardener/etcd-backup-restore/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\nURL: /github.com/gardener/etcd-backup-restore/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\n```\\n18| \\t\\\"io/ioutil\\\"\\n19| \\t\\\"log\\\"\\n20| \\t\\\"os\\\"\\n21| \\n22| \\t\\\"google.golang.org/protobuf/proto\\\"\\n23| \\t\\\"google.golang.org/protobuf/types/known/anypb\\\"\\n24| )\\n25| \\n26| type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\\n27| \\n28| func Main(handler extensionHandler) {\\n29| func Main(handler extensionHandler) {\\n30| \\t// unpack the request\\n31| \\tdata, err := ioutil.ReadAll(os.Stdin)\\n32| \\tif err != nil {\\n33| \\t\\tlog.Println(\\\"File error:\\\", err.Error())\\n34| \\t\\tos.Exit(1)\\n35| \\t}\\n36| \\tif len(data) == 0 {\\n37| \\t\\tlog.Println(\\\"No input data.\\\")\\n38| \\t\\tos.Exit(1)\\n```\\n\\n## Result 8: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/driver.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver.go\\n\\n```\\n12| \\n13| import (\\n14| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n15| )\\n16| \\n17| // Main is called by the program's main function to run the graphical\\n18| // application.\\n19| //\\n20| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n21| // specific libraries require being on 'the main thread'. It returns when f\\n22| func Main(f func(screen.Screen)) {\\n23| func Main(f func(screen.Screen)) {\\n24| \\tmain(f)\\n25| }\\n26| \\n```\\n\\n## Result 9: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/windriver/other.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/windriver/other.go\\n\\n```\\n12| \\n13| \\t\\\"golang.org/x/exp/shiny/driver/internal/errscreen\\\"\\n14| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n15| )\\n16| \\n17| // Main is called by the program's main function to run the graphical\\n18| // application.\\n19| //\\n20| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n21| // specific libraries require being on 'the main thread'. It returns when f\\n22| func Main(f func(screen.Screen)) {\\n23| func Main(f func(screen.Screen)) {\\n24| \\tf(errscreen.Stub(fmt.Errorf(\\n25| \\t\\t\\\"windriver: unsupported GOOS/GOARCH %s/%s\\\", runtime.GOOS, runtime.GOARCH)))\\n26| }\\n27| \\n```\\n\\n## Result 10: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go\\n\\n```\\n14| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n15| \\t\\\"golang.org/x/image/math/f64\\\"\\n16| \\t\\\"golang.org/x/mobile/gl\\\"\\n17| )\\n18| \\n19| // Main is called by the program's main function to run the graphical\\n20| // application.\\n21| //\\n22| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n23| // specific libraries require being on 'the main thread'. It returns when f\\n24| func Main(f func(screen.Screen)) {\\n25| func Main(f func(screen.Screen)) {\\n26| \\tif err := main(f); err != nil {\\n27| \\t\\tf(errscreen.Stub(err))\\n28| \\t}\\n29| }\\n30| \\n31| func mul(a, b f64.Aff3) f64.Aff3 {\\n32| \\treturn f64.Aff3{\\n33| \\t\\ta[0]*b[0] + a[1]*b[3],\\n34| \\t\\ta[0]*b[1] + a[1]*b[4],\\n```\\n\\n\",\"tool_call_id\":\"call_eG1GRwBeCLOUWghVcDdwhumF\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_zCYl929MzrVvYZ0oepRDlj2S\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"lang:go case:yes content:\\\\\\\"func main(\\\\\\\" type:file count:10\\\",\\\"count\\\":10,\\\"timeout\\\":60}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 10 matches across 10 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/yinchengtsinghua/go-ethereum-chinese/cmd/wnode/main.go\\n\\nURL: /github.com/yinchengtsinghua/go-ethereum-chinese/-/blob/cmd/wnode/main.go\\n\\n```\\n106| \\targServerPoW = flag.Float64(\\\"mspow\\\", whisper.DefaultMinimumPoW, \\\"PoW requirement for Mail Server request\\\")\\n107| \\n108| \\targIP = flag.String(\\\"ip\\\", \\\"\\\", \\\"IP address and port of this node (e.g. 127.0.0.1:30303)\\\")\\n109| \\targPub = flag.String(\\\"pub\\\", \\\"\\\", \\\"public key for asymmetric encryption\\\")\\n110| \\targDBPath = flag.String(\\\"dbpath\\\", \\\"\\\", \\\"path to the server's DB directory\\\")\\n111| \\targIDFile = flag.String(\\\"idfile\\\", \\\"\\\", \\\"file name with node id (private key)\\\")\\n112| argEnode = flag.String(\\\"boot\\\", \\\"\\\", \\\"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\\n113| \\targTopic = flag.String(\\\"topic\\\", \\\"\\\", \\\"topic in hexadecimal format (e.g. 70a4beef)\\\")\\n114| \\targSaveDir = flag.String(\\\"savedir\\\", \\\"\\\", \\\"directory where all incoming messages will be saved as files\\\")\\n115| )\\n116| func main() {\\n117| func main() {\\n118| \\tprocessArgs()\\n119| \\tinitialize()\\n120| \\trun()\\n121| \\tshutdown()\\n122| }\\n123| \\n124| func processArgs() {\\n125| \\tflag.Parse()\\n126| \\n```\\n\\n## Result 2: github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/cmd/wnode/main.go\\n\\nURL: /github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum/-/blob/cmd/wnode/main.go\\n\\n```\\n106| \\targServerPoW = flag.Float64(\\\"mspow\\\", whisper.DefaultMinimumPoW, \\\"PoW requirement for Mail Server request\\\")\\n107| \\n108| \\targIP = flag.String(\\\"ip\\\", \\\"\\\", \\\"IP address and port of this node (e.g. 127.0.0.1:30303)\\\")\\n109| \\targPub = flag.String(\\\"pub\\\", \\\"\\\", \\\"public key for asymmetric encryption\\\")\\n110| \\targDBPath = flag.String(\\\"dbpath\\\", \\\"\\\", \\\"path to the server's DB directory\\\")\\n111| \\targIDFile = flag.String(\\\"idfile\\\", \\\"\\\", \\\"file name with node id (private key)\\\")\\n112| argEnode = flag.String(\\\"boot\\\", \\\"\\\", \\\"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\\n113| \\targTopic = flag.String(\\\"topic\\\", \\\"\\\", \\\"topic in hexadecimal format (e.g. 70a4beef)\\\")\\n114| \\targSaveDir = flag.String(\\\"savedir\\\", \\\"\\\", \\\"directory where all incoming messages will be saved as files\\\")\\n115| )\\n116| func main() {\\n117| func main() {\\n118| \\tprocessArgs()\\n119| \\tinitialize()\\n120| \\trun()\\n121| \\tshutdown()\\n122| }\\n123| \\n124| func processArgs() {\\n125| \\tflag.Parse()\\n126| \\n```\\n\\n## Result 3: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/driver_x11.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_x11.go\\n\\n```\\n3| // license that can be found in the LICENSE file.\\n4| \\n5| //go:build (linux && !android) || dragonfly || openbsd\\n6| \\n7| package driver\\n8| \\n9| import (\\n10| \\t\\\"golang.org/x/exp/shiny/driver/x11driver\\\"\\n11| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n12| )\\n13| func main(f func(screen.Screen)) {\\n14| func main(f func(screen.Screen)) {\\n15| \\tx11driver.Main(f)\\n16| }\\n17| \\n```\\n\\n## Result 4: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/gldriver/x11.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/x11.go\\n\\n```\\n120| \\t// gl.Context?\\n121| \\tglctx gl.Context\\n122| \\tworker gl.Worker\\n123| )\\n124| \\n125| // uiClosure is a closure to be run on C's UI thread.\\n126| type uiClosure struct {\\n127| \\tf func() uintptr\\n128| \\tretc chan uintptr\\n129| }\\n130| func main(f func(screen.Screen)) error {\\n131| func main(f func(screen.Screen)) error {\\n132| \\tif gl.Version() == \\\"GL_ES_2_0\\\" {\\n133| \\t\\treturn errors.New(\\\"gldriver: ES 3 required on X11\\\")\\n134| \\t}\\n135| \\tC.startDriver()\\n136| \\tglctx, worker = gl.NewContext()\\n137| \\n138| \\tclosec := make(chan struct{})\\n139| \\tgo func() {\\n140| \\t\\tf(theScreen)\\n```\\n\\n## Result 5: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/driver_darwin.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_darwin.go\\n\\n```\\n3| // license that can be found in the LICENSE file.\\n4| \\n5| //go:build darwin && !metal\\n6| \\n7| package driver\\n8| \\n9| import (\\n10| \\t\\\"golang.org/x/exp/shiny/driver/gldriver\\\"\\n11| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n12| )\\n13| func main(f func(screen.Screen)) {\\n14| func main(f func(screen.Screen)) {\\n15| \\tgldriver.Main(f)\\n16| }\\n17| \\n```\\n\\n## Result 6: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/gldriver/cocoa.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/cocoa.go\\n\\n```\\n88| \\n89| \\tw.ctx = ctx\\n90| \\tgo drawLoop(w, vba)\\n91| }\\n92| \\n93| func closeWindow(id uintptr) {\\n94| \\tC.doCloseWindow(C.uintptr_t(id))\\n95| }\\n96| \\n97| var mainCallback func(screen.Screen)\\n98| func main(f func(screen.Screen)) error {\\n99| func main(f func(screen.Screen)) error {\\n100| \\tif tid := C.threadID(); tid != initThreadID {\\n101| \\t\\tlog.Fatalf(\\\"gldriver.Main called on thread %d, but gldriver.init ran on %d\\\", tid, initThreadID)\\n102| \\t}\\n103| \\n104| \\tmainCallback = f\\n105| \\tC.startDriver()\\n106| \\treturn nil\\n107| }\\n108| \\n```\\n\\n## Result 7: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/gldriver/win32.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/win32.go\\n\\n```\\n21| \\t\\\"golang.org/x/mobile/event/paint\\\"\\n22| \\t\\\"golang.org/x/mobile/event/size\\\"\\n23| \\t\\\"golang.org/x/mobile/gl\\\"\\n24| )\\n25| \\n26| // TODO: change this to true, after manual testing on Win32.\\n27| const useLifecycler = false\\n28| \\n29| // TODO: change this to true, after manual testing on Win32.\\n30| const handleSizeEventsAtChannelReceive = false\\n31| func main(f func(screen.Screen)) error {\\n32| func main(f func(screen.Screen)) error {\\n33| \\treturn win32.Main(func() { f(theScreen) })\\n34| }\\n35| \\n36| var (\\n37| \\teglGetPlatformDisplayEXT = gl.LibEGL.NewProc(\\\"eglGetPlatformDisplayEXT\\\")\\n38| \\teglInitialize = gl.LibEGL.NewProc(\\\"eglInitialize\\\")\\n39| \\teglChooseConfig = gl.LibEGL.NewProc(\\\"eglChooseConfig\\\")\\n40| \\teglGetError = gl.LibEGL.NewProc(\\\"eglGetError\\\")\\n41| \\teglBindAPI = gl.LibEGL.NewProc(\\\"eglBindAPI\\\")\\n```\\n\\n## Result 8: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/gldriver/other.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/other.go\\n\\n```\\n18| \\n19| var errUnsupported = fmt.Errorf(\\\"gldriver: unsupported GOOS/GOARCH %s/%s or cgo not enabled\\\", runtime.GOOS, runtime.GOARCH)\\n20| \\n21| func newWindow(opts *screen.NewWindowOptions) (uintptr, error) { return 0, errUnsupported }\\n22| \\n23| func initWindow(id *windowImpl) {}\\n24| func showWindow(id *windowImpl) {}\\n25| func closeWindow(id uintptr) {}\\n26| func drawLoop(w *windowImpl) {}\\n27| \\n28| func main(f func(screen.Screen)) error { return errUnsupported }\\n29| func main(f func(screen.Screen)) error { return errUnsupported }\\n30| \\n```\\n\\n## Result 9: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/driver_windows.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_windows.go\\n\\n```\\n1| // Copyright 2015 The Go Authors. All rights reserved.\\n2| // Use of this source code is governed by a BSD-style\\n3| // license that can be found in the LICENSE file.\\n4| \\n5| package driver\\n6| \\n7| import (\\n8| \\t\\\"golang.org/x/exp/shiny/driver/windriver\\\"\\n9| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n10| )\\n11| func main(f func(screen.Screen)) {\\n12| func main(f func(screen.Screen)) {\\n13| \\twindriver.Main(f)\\n14| }\\n15| \\n```\\n\\n## Result 10: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/driver_fallback.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver_fallback.go\\n\\n```\\n5| //go:build !darwin && (!linux || android) && !windows && !dragonfly && !openbsd\\n6| \\n7| package driver\\n8| \\n9| import (\\n10| \\t\\\"errors\\\"\\n11| \\n12| \\t\\\"golang.org/x/exp/shiny/driver/internal/errscreen\\\"\\n13| \\t\\\"golang.org/x/exp/shiny/screen\\\"\\n14| )\\n15| func main(f func(screen.Screen)) {\\n16| func main(f func(screen.Screen)) {\\n17| \\tf(errscreen.Stub(errors.New(\\\"no driver for accessing a screen\\\")))\\n18| }\\n19| \\n```\\n\\n\",\"tool_call_id\":\"call_zCYl929MzrVvYZ0oepRDlj2S\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.openai.com/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"TkmxdJX78D"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ro"},"finish_reason":null}],"usage":null,"obfuscation":"7oLxdc8D1s"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"498"},"finish_reason":null}],"usage":null,"obfuscation":"EKSI4X72c"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"9"},"finish_reason":null}],"usage":null,"obfuscation":"6bEO1MrS26k"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/text"},"finish_reason":null}],"usage":null,"obfuscation":"yCSGPlZ"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"img"},"finish_reason":null}],"usage":null,"obfuscation":"8ZuhXSoO9"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"olKl5jn"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"iG2mlOoDj"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":";"},"finish_reason":null}],"usage":null,"obfuscation":"xTZ3iWuhnN6"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"ASdrt"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"1H2Vi8ee"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/un"},"finish_reason":null}],"usage":null,"obfuscation":"2L11wzGHf"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ig"},"finish_reason":null}],"usage":null,"obfuscation":"2XpFkNcXEg"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"orn"},"finish_reason":null}],"usage":null,"obfuscation":"KApkQDJT3"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"el"},"finish_reason":null}],"usage":null,"obfuscation":"rU6ndAHeIo"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/un"},"finish_reason":null}],"usage":null,"obfuscation":"tHfyHX9Qh"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ig"},"finish_reason":null}],"usage":null,"obfuscation":"8dmT86PCft"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"orn"},"finish_reason":null}],"usage":null,"obfuscation":"tJOVHmJja"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"el"},"finish_reason":null}],"usage":null,"obfuscation":"4mfE4zKWZM"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/in"},"finish_reason":null}],"usage":null,"obfuscation":"Uos5cwhTm"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tegration"},"finish_reason":null}],"usage":null,"obfuscation":"1p2"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tests"},"finish_reason":null}],"usage":null,"obfuscation":"75cHfT"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/tests"},"finish_reason":null}],"usage":null,"obfuscation":"OkFZul"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"Z9jDhjRGUxm"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"console"},"finish_reason":null}],"usage":null,"obfuscation":"SlJ9G"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/simple"},"finish_reason":null}],"usage":null,"obfuscation":"y7tVW"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"QIScqPc"} + + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"uoKaZNlE4"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Results"},"finish_reason":null}],"usage":null,"obfuscation":"oxkXq"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":";"},"finish_reason":null}],"usage":null,"obfuscation":"DAIm0BEqUYG"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" limited"},"finish_reason":null}],"usage":null,"obfuscation":"eQsz"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"dhUQJ"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" to"},"finish_reason":null}],"usage":null,"obfuscation":"tBQT1JGUX"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"0Dte1D6y"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"BGj6RM3VUhE"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/M"},"finish_reason":null}],"usage":null,"obfuscation":"YIEVTqVnvq"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"10"},"finish_reason":null}],"usage":null,"obfuscation":"TNt1XG8F3w"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ichael"},"finish_reason":null}],"usage":null,"obfuscation":"g3u67W"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"5UibFA8WUnP"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"C"},"finish_reason":null}],"usage":null,"obfuscation":"iScLn7Lvs4Y"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" Example"},"finish_reason":null}],"usage":null,"obfuscation":"tWgI"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ade"},"finish_reason":null}],"usage":null,"obfuscation":"k5hEWKjbr"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" query"},"finish_reason":null}],"usage":null,"obfuscation":"5TiXvP"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"gKf4E7isMym"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":\n"},"finish_reason":null}],"usage":null,"obfuscation":"YaCg9cNQt"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"90"},"finish_reason":null}],"usage":null,"obfuscation":"oAwq5yqJPv"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"lang"},"finish_reason":null}],"usage":null,"obfuscation":"PtJadCBC"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Days"},"finish_reason":null}],"usage":null,"obfuscation":"4vQ2dMJJ"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"D9B8G37iv0C"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Of"},"finish_reason":null}],"usage":null,"obfuscation":"YKCUg3BQp8"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"VvbIGDdzYn"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Dev"},"finish_reason":null}],"usage":null,"obfuscation":"DcaSny5fl"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" case"},"finish_reason":null}],"usage":null,"obfuscation":"kquKzeW"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Ops"},"finish_reason":null}],"usage":null,"obfuscation":"UrafILW4B"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"odirr68aGrP"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"pbN3pXXW8Kh"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"yes"},"finish_reason":null}],"usage":null,"obfuscation":"X2zWw31Pc"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"202"},"finish_reason":null}],"usage":null,"obfuscation":"13qcVMnSf"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" content"},"finish_reason":null}],"usage":null,"obfuscation":"v0dH"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"2"},"finish_reason":null}],"usage":null,"obfuscation":"F6FlZffKsXr"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":\""},"finish_reason":null}],"usage":null,"obfuscation":"LSKrXsMRV"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/tr"},"finish_reason":null}],"usage":null,"obfuscation":"pTQD2PGC2"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"func"},"finish_reason":null}],"usage":null,"obfuscation":"7yqmuJKn"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"Ns39jKkt7ic"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"fBdjQyD"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Days"},"finish_reason":null}],"usage":null,"obfuscation":"xsUze35g"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"(\""},"finish_reason":null}],"usage":null,"obfuscation":"G6n0iTT4J"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"RBCov4uAGXD"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" type"},"finish_reason":null}],"usage":null,"obfuscation":"VVGSc4C"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Go"},"finish_reason":null}],"usage":null,"obfuscation":"sNE3qY70QY"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":file"},"finish_reason":null}],"usage":null,"obfuscation":"Z1LZDtj"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"6gMziMgA1Pt"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" count"},"finish_reason":null}],"usage":null,"obfuscation":"tyhw8f"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"hello"},"finish_reason":null}],"usage":null,"obfuscation":"GHcENTY"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"IHZW3jdt7U6"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"iF0vrYx3c"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"10"},"finish_reason":null}],"usage":null,"obfuscation":"IyZ7VLwPNT"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"KaCkX6QioMG"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"I6McGs"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"VlqSBR"} - data: {"id":"chatcmpl-CTnvunTecuCMr1iu4GnvlBVJ9MMMg","object":"chat.completion.chunk","created":1761219490,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":11883,"completion_tokens":28,"total_tokens":11911,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"ep1wm"} + data: {"id":"chatcmpl-CTtFpQ2sfws4k7IHvh95nJzHhsoyW","object":"chat.completion.chunk","created":1761239945,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":8014,"completion_tokens":604,"total_tokens":8618,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":512,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"v"} data: [DONE] @@ -384,4 +369,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.63876275s + duration: 14.733060291s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml index c1b1b72605821f7578cd89541a2319a3282a2048..9cd1fca3e628bf4331e57f645108bf88f9aa6284 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml @@ -24,25 +24,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OxhGdRyp1mnS8O"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"EKCOd06vmcIddk"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Changing"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"tz7olzIb"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Update"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"0OYz1m5jLX"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Print"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"tpb5c272wb"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"p4nHifyvhN4"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Statement"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BrDALU"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":".go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"F2Rbvr8RJCrSa"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" to"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"uEzS3Is70f6Ie"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" to"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"o5nLkzOENKDA1"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Custom"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ypWrTgtTw"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Print"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"69mGHAJkUa"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Welcome"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"HGkfX91N"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" \""},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"nnZZ5wSixKVKe"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Message"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZNehWbUD"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"o6Zx5r42r5d"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"Tf0CjWsQfA"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" from"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"0yejUWmUrBi"} - data: {"id":"chatcmpl-CTnsl7uyIEQLnKLCeVcwJzV5O51fJ","object":"chat.completion.chunk","created":1761219295,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":139,"completion_tokens":7,"total_tokens":146,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"TTbGOFvAcCt4us"} + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Crush"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Sd93OiuCPr"} + + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"\""},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"sjf8VtrHRDxXIX"} + + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"ZK3NZXgwt2"} + + data: {"id":"chatcmpl-CTtCIaOhzMJZhYpyLFfYHvspr5OH4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":139,"completion_tokens":10,"total_tokens":149,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"iNuQdkM72ThLL"} data: [DONE] @@ -51,15 +57,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 582.088292ms + duration: 597.170459ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29883 + content_length: 34339 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -75,31 +81,65 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_Wa8nxiYWCcBFQAvMGsGLmHCl","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"F2QVWyRIzw3spS"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_pXKzauntjK740LCfAkfJsrRS","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"78JusVqMwAvgsl"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"8TkiaMph5RbTH2p"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N89xNo03HZ3Ao3"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5WJ9Qpno9TaoM0g"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FRJaxongiFGF8g"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TQDv77rX8QQlKgR"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0w4iUIKK1LGbIEA"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yGcqKZHGHHZcUXR"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vo75C5grOYoME"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TL5SiUjHPo5dP"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vvsyvhEwWkO23"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"I1mfdiduCZmGS"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GIu3W2cqzb8Sw"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"JDjYSg59ZqVs9qB"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"W"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9qDa0ySDr9KeqC"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iQSAtIo3elo1n8M"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Oz3w4Yw5lVf"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \".\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"M429lBy3TSA"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"jxXwLWs68pIMjXM"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FMcbWFuW0iFi9"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yYkao7LEpijCo"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"UZreLktZE56gDjZ"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"83aoBFbbW8jg6Sp"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"BuRk2doMmL7Us9R"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"7"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3XTqC2jPecO3Y"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LT4Q3QaQ1VOKYla"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"1"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C"} - data: {"id":"chatcmpl-CTnslhfilo1RcT5OuYdzEX3Loz3VA","object":"chat.completion.chunk","created":1761219295,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6476,"completion_tokens":220,"total_tokens":6696,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":192,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Q"} + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"B"} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtCIJOANVVkXiTJriR0B16gD7CY4","object":"chat.completion.chunk","created":1761239726,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7409,"completion_tokens":173,"total_tokens":7582,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"n"} data: [DONE] @@ -108,15 +148,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 5.289429917s + duration: 4.983803959s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30212 + content_length: 34724 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -132,59 +172,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_ArFVi3JY4UWeYQo1nG9l2UHy","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"pF3rt2oVW4K8"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_8CabCVI9eFDOvoNwIRlcpqKa","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"KOpWdy3tUyDC"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"vDa1LXJqumwZSqp"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"cr9h1HgzMpGqhTs"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CSnxZmi04NKwO3"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XKWXaw0RrpD4yz"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f9UN93GpT3kET"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xVF4ulppsJQEV"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xz7UBaWuMGedNNz"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2oYCPwiGcgO1lVu"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cIU79NXivTvGMDd"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CGcJ7Y5vEVNKRJF"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gZ01pK3mKLROISZ"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VQrJYRjfR6uyBLH"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QLabdJ7gD0V2GO9"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y38UfUIDFodfWqM"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0V5zpt5ifWeaJg6"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nKrIqbd1hZK23wC"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VSxOggFZaypNm"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KsoODOXXlqkgh"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8tU7cWUrNv5kj"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"E63HCJMTPlTlm"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bj8Y3ADP0maO1"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TgOoifMzzvhUN"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SzhJZydgE6sVR"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tYO6diPT1Aec6"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3t92ECGBQuCBs"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8Asp0zlfUQAgD"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"u"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BbRDgt9zYtM"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ung5YnGYiEO"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8v0SvBOWz3O91"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rF7KTtyyTeEU0"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FO7NhOEG9A1DQ"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N4fW3ZCOkok5j"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z7Y6syEmUjTerH9"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iADOUXLMovP2821"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EF7X03u8vHCj7ws"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pT7Wh6Rh9SHMZZJ"} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsqGFaJSRAmlEw3HiIwSIa1F4yL","object":"chat.completion.chunk","created":1761219300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6537,"completion_tokens":35,"total_tokens":6572,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"D7oZ"} + data: {"id":"chatcmpl-CTtCN9oLXPFY9HSZiVaT9J1OvQT87","object":"chat.completion.chunk","created":1761239731,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7486,"completion_tokens":35,"total_tokens":7521,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"OTi5"} data: [DONE] @@ -193,15 +233,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.044222375s + duration: 2.637065708s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30660 + content_length: 35172 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -217,59 +257,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_lH6mbJbFqv4bAiHRAuifJsTp","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"5htQNoYIICHL"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_FPzIXdEJMaLXuwgcDzp1GrUe","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"w4e2zKOLEFuc"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZhESW6QMj8HBAxK"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"XvIK254vUyE2Wzy"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kRViH08UgnVFrU"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n0ywMXawh5w2kf"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KWh5aHSBwivPe"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aFUoRe9s42rFX"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FanrHVsvtjiynGg"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7n6IkRzeW1tGa4j"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"K6S5Ytc5Fz7zDJs"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Mi6L4jgkXmjJbnZ"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dpQfBEvr40CnYat"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pMAJya66j7HRb37"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qnvD39qvYbu34qU"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bEupnJqL4w8t1hB"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"E0Q7iWBpsIFdyFi"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m3GWj1SFlFRkaVQ"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qyf4EA1fIIIwt"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Zl0QbYz7eB4dE"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ntyzPq0ktRzpD"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N3N1oObb0HHNo"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7MtqAI9SMzZzF"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xwDE9wesC4EDy"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3lNRQiSlEyfhY"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GclIxYqLk7gfQ"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MNTqkIlyGPRgT"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EIs7UOFlRFahO"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"e"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"e"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eNrTSmuw3yT"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YnoPka6HNhc"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5gWfvDgHdOiAz"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9i71R6DZGKo71"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CF7KA4nhjJBaQTR"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2Ak1L1mjYP1Vh5K"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".mod"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SZ9kfoVw5ez6Pc"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".mod"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jPb5Jg4uUhmTPX"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LsxlmxaM52AXrVt"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qcVQkQmm6ohemrF"} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnssP5Sj10LNExmFiln4AyzC62Il","object":"chat.completion.chunk","created":1761219302,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6634,"completion_tokens":361,"total_tokens":6995,"prompt_tokens_details":{"cached_tokens":6528,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":320,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"N"} + data: {"id":"chatcmpl-CTtCTd9sxUtSnFPT0CWK5knzPZl94","object":"chat.completion.chunk","created":1761239737,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7583,"completion_tokens":617,"total_tokens":8200,"prompt_tokens_details":{"cached_tokens":7424,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":576,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"o"} data: [DONE] @@ -278,15 +318,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 6.583581541s + duration: 18.60522775s - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31036 + content_length: 35548 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_lH6mbJbFqv4bAiHRAuifJsTp\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_lH6mbJbFqv4bAiHRAuifJsTp\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_FPzIXdEJMaLXuwgcDzp1GrUe\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_FPzIXdEJMaLXuwgcDzp1GrUe\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -302,113 +342,145 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_o0u65HA4wQDn0xJQCE31VJc2","type":"function","function":{"name":"edit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"zJ7aPD1QkvLp"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_kDlxWt9HxmhuJQ799z3345KV","type":"function","function":{"name":"edit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"siCFgzEzckuz"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"M8tUxm1amVYJ8Ji"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"595j4C3fDDJ5Oi"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"07Z50oIHc4PZ3"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"O62t9os9HL9DIcq"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OiO3rXjYGVLSzzy"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y6zZKj4zrsDqjgX"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gQArNgrRsSoVaTy"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jFoxO11KsGPzeEJ"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CCMoBgE829ALx"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rZbBnMPmlVvRU"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pzzcDxygI3Ys5"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KTAkmeI4zZxNs"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ttkuS8jHT8bqI"} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"OqdzVF6ecjT1JD9"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lg6vcw2t0zl66G"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kZAUUrHJZiOCA"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hTRB0Wh7ocf"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"32I9zhJwuIAGKiw"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kO2qGvORa5T3c82"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LO92rmBhiTSBZ"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0vmu65cuNfWqKMS"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rh1xHG5miC1Lo"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SNVZlCeTUvoQztG"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H4hUPzamZyIFBgD"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"e42WM5RLanJVtuN"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"pvtFGE5rBXJc0"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"unscqepNGjzHG"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Gnz0FRubDuIswcB"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xZhHSDr7qUOmm"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rtQeERaTZGi"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zWJ76GvTFS7nY"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Xa5y2lJ0oSB4W"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jFROflY4HvWNJ"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"negB9xfsxPyUQS"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KvnoBiAkmmco0"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fOW46peTGbsVZ"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rw8nsn1amJKsZK"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gVyNaNc9SUn7cl9"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"V"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LiKgBOmqxClONkn"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ataaPpURIhn"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2JfinwK2TT"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"0qGNKggJF3aOH"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Oxp9sB7DhELV1"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FNnZODsbS5XXA"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cCM4TPwUFMB01"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FzWxEZE5GWrhWff"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BMzYH8x2GGLu"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"0aiNm3YZs2aAo"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ARsWQ3QWpnrazVA"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P6WIyd6oXUbDBG3"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0ZnrJtfo9Mt9Zgb"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"anjgmRb9AN4"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"tWbjR1vYsHNH1"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EmMl8rZauW7iI55"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tf"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"mt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"WPobseSquUDJa"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KV9QQkeUFB"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QBrH7MhxMm7XWa1"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"kRy6O4jzNvh3O"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5kdlfj06HGQ"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wk90LeuKQzDgc"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"k4Cw2KDLXKHBx"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dx2fUJGVX0EcAS"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AoxuCuy6aPns"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1AWB7LYGeO1Yw"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3KSMm3iIyNGDLKJ"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HajTsrENY6mO4mh"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ofnsEd91jFIgdH"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ayyc9BEYwftLf"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6SUrtoXtnTPYlMF"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8eWR1xTqLe56FH5"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gXhT0FhiBDX"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"apoM9TDNUvGM65c"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"rTrvFTqmTAlLs"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uKOV6xmFj2"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"c6HoA8w1btvVh"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tf"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"myM70VjKN1JWn"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"mt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" from"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9bIsA1d3cg2OM"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ADhuu9iJ9U"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sgmZbfwY9Xl3"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"U9Fxs8kpZDBld"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xWCdWGaDq5xGZ"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"s2MP5X1HwC9ei"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" from"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lqUOD7yw61PoY"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0zWcU7BkkHuB"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ATMwac8tCwSwplF"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KzQmhGhgxCjNF"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OMX8ybM52TwKCo0"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dPglyhH1gA6HbVC"} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnsz9oD63oBwvtv5cRPqsLxAvdDK","object":"chat.completion.chunk","created":1761219309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6709,"completion_tokens":644,"total_tokens":7353,"prompt_tokens_details":{"cached_tokens":6528,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":576,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"n"} + data: {"id":"chatcmpl-CTtCjxFE6XqNqpImcIZgPDFSF6xy5","object":"chat.completion.chunk","created":1761239753,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7658,"completion_tokens":724,"total_tokens":8382,"prompt_tokens_details":{"cached_tokens":7552,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":640,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"r"} data: [DONE] @@ -417,15 +489,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 9.547513917s + duration: 21.000050458s - id: 5 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31563 + content_length: 36121 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_lH6mbJbFqv4bAiHRAuifJsTp\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_lH6mbJbFqv4bAiHRAuifJsTp\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_o0u65HA4wQDn0xJQCE31VJc2\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_o0u65HA4wQDn0xJQCE31VJc2\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_FPzIXdEJMaLXuwgcDzp1GrUe\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_FPzIXdEJMaLXuwgcDzp1GrUe\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_kDlxWt9HxmhuJQ799z3345KV\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\\n\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\\n}\\\\n\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_kDlxWt9HxmhuJQ799z3345KV\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -441,81 +513,81 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_gRff8NsecYHFsCOKKmUYNcuS","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"prnI65B4XFqZ"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_A0s7KddYbxCPmcyi0pUyXIts","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"EE2DFBoISbIK"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"DYohnFnZv58BlGD"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"2rjoPPRqHWA1MFb"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IyeMjL8ke6c"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gBC6B1NrnS8"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"GSOQVKiVwCk6R"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RvnW8b4FHJwcz"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VtOFdNv8EJh6dh"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4Hhl6ZbIp6avN7"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uEepOXAoT4Qjst6"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6o9sRzYE2IuZ0tJ"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"grQNO6rLNrziilI"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TF1n7ENRiPHBR8t"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VyCUxsbuiQFfoxs"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DjNQ38dre1FFYMt"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z1zQVisZvUhXU"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"njJ7wPklPOLj7"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8IuEnv4jcUQPb"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Upu1DP5HSweTs"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yZP2NqYGIsK5N"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HCNEo55saR6mv"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cTupb3wKutzrb"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"K5NBRhbvL25eU"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eia67fGsS9THM"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jU2C7904N2hng"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"G"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"m"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jCbvrKjLyUA"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uBiyQG2xhI7"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"f2Z4OIUDXSwPk"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7VrrSnn7HpMu6"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7QYXWGEnl6IET"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"efNOnTWVTypLB"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2mD3tLhs9ARfCXd"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N2avFO6b42o3SQT"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"u7qJqqWIYpc7N"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"hvzFtt3Y7vAen"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"u22e3Bj"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gZgMxoz"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"tl51zfmHVcgB5"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"D9kZ3oFWKzVYW"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qNGF0epT5fhUB21"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LTtKotf0S2ZEvkp"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hs12ur7WVCSHvk"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WleDBFYjrjk17p"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C5VK2k4zGZOmvXv"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4jz4wHAA0NXoCwI"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xikSK4QVSl"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DNGcPIBaZI"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OFsWRO9aP4mqZfL"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iHcYq4zQ7rCLLu5"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OzHQvSsarrAN7"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" verify"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BfJ9sQ5ekk4"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" output"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7s1E7hhwwuN"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" output"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7bHW7wjpRHz"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ndaEO6q0V0VrcS6"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SXP3gyknzSjvcfz"} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnt9rBZWrdIMn7IujVVj3d7Ul7EA","object":"chat.completion.chunk","created":1761219319,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6812,"completion_tokens":47,"total_tokens":6859,"prompt_tokens_details":{"cached_tokens":6656,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Xubk"} + data: {"id":"chatcmpl-CTtD5lHr0JRjs2hX3wiFwyhyZDSE1","object":"chat.completion.chunk","created":1761239775,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7777,"completion_tokens":47,"total_tokens":7824,"prompt_tokens_details":{"cached_tokens":7552,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"uX40"} data: [DONE] @@ -524,15 +596,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.214903708s + duration: 2.08773825s - id: 6 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 32008 + content_length: 36568 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_Wa8nxiYWCcBFQAvMGsGLmHCl\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_ArFVi3JY4UWeYQo1nG9l2UHy\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_lH6mbJbFqv4bAiHRAuifJsTp\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_lH6mbJbFqv4bAiHRAuifJsTp\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_o0u65HA4wQDn0xJQCE31VJc2\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_o0u65HA4wQDn0xJQCE31VJc2\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_gRff8NsecYHFsCOKKmUYNcuS\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"description\\\":\\\"Run the Go program to test output\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"hello from crush\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\",\"tool_call_id\":\"call_gRff8NsecYHFsCOKKmUYNcuS\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_pXKzauntjK740LCfAkfJsrRS\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_8CabCVI9eFDOvoNwIRlcpqKa\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_FPzIXdEJMaLXuwgcDzp1GrUe\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_FPzIXdEJMaLXuwgcDzp1GrUe\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_kDlxWt9HxmhuJQ799z3345KV\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\\n\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\\n}\\\\n\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_kDlxWt9HxmhuJQ799z3345KV\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_A0s7KddYbxCPmcyi0pUyXIts\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"description\\\":\\\"Run the Go program to verify output\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"hello from crush\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\",\"tool_call_id\":\"call_A0s7KddYbxCPmcyi0pUyXIts\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -548,13 +620,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTntBWAuqcPe8WDYfLWLGBEHDO2Kd","object":"chat.completion.chunk","created":1761219321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"CQpyPqNUux"} + data: {"id":"chatcmpl-CTtD8mfWf7HnRw0EZVLTjpU8iDgL1","object":"chat.completion.chunk","created":1761239778,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"g2sV9ZoSc5"} - data: {"id":"chatcmpl-CTntBWAuqcPe8WDYfLWLGBEHDO2Kd","object":"chat.completion.chunk","created":1761219321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"XKcYvMFH"} + data: {"id":"chatcmpl-CTtD8mfWf7HnRw0EZVLTjpU8iDgL1","object":"chat.completion.chunk","created":1761239778,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"GhwZ3C1U"} - data: {"id":"chatcmpl-CTntBWAuqcPe8WDYfLWLGBEHDO2Kd","object":"chat.completion.chunk","created":1761219321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"uFic85"} + data: {"id":"chatcmpl-CTtD8mfWf7HnRw0EZVLTjpU8iDgL1","object":"chat.completion.chunk","created":1761239778,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"vunUTh"} - data: {"id":"chatcmpl-CTntBWAuqcPe8WDYfLWLGBEHDO2Kd","object":"chat.completion.chunk","created":1761219321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6895,"completion_tokens":4,"total_tokens":6899,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Kq12tWHV"} + data: {"id":"chatcmpl-CTtD8mfWf7HnRw0EZVLTjpU8iDgL1","object":"chat.completion.chunk","created":1761239778,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7860,"completion_tokens":4,"total_tokens":7864,"prompt_tokens_details":{"cached_tokens":7808,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"qWYa6"} data: [DONE] @@ -563,4 +635,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.045222709s + duration: 3.821753209s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml index 6b245407941871305cc32c42442d42575fb4485b..05db5f823f05e8def4f8baa7ec1665ad82581a06 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml @@ -24,23 +24,27 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"M0bqTtIbWsOVtp"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9IM2B8RDLykuZI"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Create"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"rnV6xaP926"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":"Create"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"cSpVxFzNqT"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" config"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"4DZr0757E"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" a"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"dkaBgpsuupsz9U"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":".json"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"PEuJJcJFYoE"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" config"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bUYPc3MHy"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"flXSEhQvX94"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":".json"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5UfcMCL4wxz"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" JSON"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LSGxg4WokwO"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" file"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9CDfYLuihGE"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" content"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"vJiNekBy"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9ZCut1riAmI"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"X4xBihvmE6"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" JSON"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"yHyczAJU8WF"} - data: {"id":"chatcmpl-CTnvwI9MP4tHmEZLi5NBiGPvgWYQk","object":"chat.completion.chunk","created":1761219492,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":153,"completion_tokens":6,"total_tokens":159,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"oxcE3zicLOXntl"} + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{"content":" content"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Xa9OhCGt"} + + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"PlPpmJ9HWM"} + + data: {"id":"chatcmpl-CTtG4lwA5ItN2GErUKFadhUCdxPFu","object":"chat.completion.chunk","created":1761239960,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_eb3c3cb84d","choices":[],"usage":{"prompt_tokens":153,"completion_tokens":8,"total_tokens":161,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"9X2WpF9zMcGakO"} data: [DONE] @@ -49,15 +53,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.317672083s + duration: 356.397042ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29920 + content_length: 34376 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -73,97 +77,97 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_TjZLEp9jkCTvKKhOz76gkRQh","type":"function","function":{"name":"write","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"81UYdaXIHZB"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_mbKPcfwT3s7QaXWMah7cNQ0a","type":"function","function":{"name":"write","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"4eXuXxj1Jv9"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"PbN2pEi4UMuBDYa"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Cg1rXJTUxIpAj8n"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iBQX3kmVtChiPv"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IyHREFXkc63VQk"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RpXZc3iq22JC4"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"77rJqBO56rN6l"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Cg8U99O4iuJKO9A"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zs5K7MJKX0vB7ok"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PcGb21Zan6Q7RBM"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SLamqKFMudVJ92M"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"90vqa37YnqGFkS4"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cTQTi8V3Td5Fc79"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FZfjoIJTwlcjydW"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ze05LhpSPpU8efg"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z3b7REaD4XhOVJR"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ehKG2xCbxyjyqtp"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wRWZGZAukppU8"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9gxIIwO34kYlT"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MiOZXJYM96t0G"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xbS0qQE0mPhMm"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zp5j5Tvgwst4x"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"E56c49cYlsJKh"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NRv9vKoTRIFjP"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NsL5C8YQPCJTn"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Fa5sc6lpO6Hpp"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vzINDDhuKNg90"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"X"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"A"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/write"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oqT0o2skg2rn"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/write"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SoHKBkYCuh4k"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OHrzJxE4sXmn3"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XOkY7umXdYFqa"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/config"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z681EomrhYE"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/config"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6RkgYn8doC1"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".json"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kPLvcTyEQp5nU"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".json"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mgdYHqjX95bmq"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"eSlCBkFSP0hIq"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"pTNhSnybATViZ"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VmN3SHI08Qk"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hsvl6Dcc8TF"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"lBKFFTDffaTkD"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"f8G9ctYUImjpo"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"GLrzJT464Xlrm"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RWTMfMCr0uCEg"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"name"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J7n7rlZsgtaeZl"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"name"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wbG4TmfCrH8Ns5"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sHkTCmAFrnhSZ"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XRcgUxGtanswV"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"dAfFHgsSOfMXj"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"zXGoawOxz2wLH"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xeXGXTU32v5uCe"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Dds3vEMCd2rpAp"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"YK3kczWPMPWND"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"5SabPivzcay7V"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"EQK9Eup5a3h1E"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"hnHfr693rHkON"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"version"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bZizx0ak83k"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"version"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ONSrIOOg9Gu"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CvquthxPuuB5m"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9wA8VXq3c5XX5"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"UXmuFWhVhX2ZQ"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"dyqHeJoAgERRi"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"1"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"1"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"a"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"0"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"D"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"O"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"p"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rl4zzYy8elbx8C"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Bxw8TW5Jc5q5el"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"B"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7krRc08w9QylktF"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x2mlG7KYretqInQ"} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CTnvwba8u9amDPNpZXzWIzoGjjP78","object":"chat.completion.chunk","created":1761219492,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6490,"completion_tokens":636,"total_tokens":7126,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":576,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"XwGG"} + data: {"id":"chatcmpl-CTtG5ar8DacNlOboIHhxXMMOE1RfJ","object":"chat.completion.chunk","created":1761239961,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7423,"completion_tokens":764,"total_tokens":8187,"prompt_tokens_details":{"cached_tokens":1920,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":704,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"P"} data: [DONE] @@ -172,15 +176,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 17.913437334s + duration: 23.529713708s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30409 + content_length: 34865 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_TjZLEp9jkCTvKKhOz76gkRQh\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\\",\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\n\",\"tool_call_id\":\"call_TjZLEp9jkCTvKKhOz76gkRQh\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_mbKPcfwT3s7QaXWMah7cNQ0a\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\\",\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\n\",\"tool_call_id\":\"call_mbKPcfwT3s7QaXWMah7cNQ0a\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -196,13 +200,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CTnwFMOVQzCcST2CZU5upKJrS6cV9","object":"chat.completion.chunk","created":1761219511,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"qykIA2JU8r"} + data: {"id":"chatcmpl-CTtGTG3y6VucBiZZuTrOvp42qzFbn","object":"chat.completion.chunk","created":1761239985,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"SmSZFxpffs"} - data: {"id":"chatcmpl-CTnwFMOVQzCcST2CZU5upKJrS6cV9","object":"chat.completion.chunk","created":1761219511,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"tgaflgcz"} + data: {"id":"chatcmpl-CTtGTG3y6VucBiZZuTrOvp42qzFbn","object":"chat.completion.chunk","created":1761239985,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"TU1P7MIL"} - data: {"id":"chatcmpl-CTnwFMOVQzCcST2CZU5upKJrS6cV9","object":"chat.completion.chunk","created":1761219511,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"RD2Jcq"} + data: {"id":"chatcmpl-CTtGTG3y6VucBiZZuTrOvp42qzFbn","object":"chat.completion.chunk","created":1761239985,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"P7Xltk"} - data: {"id":"chatcmpl-CTnwFMOVQzCcST2CZU5upKJrS6cV9","object":"chat.completion.chunk","created":1761219511,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":6583,"completion_tokens":4,"total_tokens":6587,"prompt_tokens_details":{"cached_tokens":6400,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"RDPaM"} + data: {"id":"chatcmpl-CTtGTG3y6VucBiZZuTrOvp42qzFbn","object":"chat.completion.chunk","created":1761239985,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":7516,"completion_tokens":4,"total_tokens":7520,"prompt_tokens_details":{"cached_tokens":7296,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"e5xNU"} data: [DONE] @@ -211,4 +215,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.55601675s + duration: 2.324690208s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml index acc57e9169791bed01c26e823e24594e6e51e315..69e66e6887cb526568c39f2b582020026082f5e1 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml @@ -1,146 +1,180 @@ --- version: 2 interactions: -- id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 775 - host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse bash to create a file named test.txt with content ''hello bash''\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":" test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":" bash"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":" bash"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761239548-iE24hRsdSyjW1rz3L5yq","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239548,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":141,"completion_tokens":9,"total_tokens":150,"cost":0.00002964,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00001974,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 4.331630542s -- id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 29988 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.bash:0","index":0,"type":"function","function":{"name":"bash","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"command\": \"echo 'hello bash' > test.txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\", \"description"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\": \"Create test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt with '"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"hello bash' content"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"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-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - - data: {"id":"gen-1761239545-Ut8GeJOvdw3ptcG1YPZe","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239545,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7107,"completion_tokens":38,"total_tokens":7145,"cost":0.007221,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.007107,"upstream_inference_completions_cost":0.000114},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 5.350808083s -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 30293 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.bash:0\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"echo 'hello bash' > test.txt\\\", \\\"description\\\": \\\"Create test.txt with 'hello bash' content\\\"}\",\"name\":\"bash\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"functions.bash:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761239551-uCBwuH9rypIA5T2wPdgz","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239551,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239551-uCBwuH9rypIA5T2wPdgz","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239551,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239551-uCBwuH9rypIA5T2wPdgz","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239551,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761239551-uCBwuH9rypIA5T2wPdgz","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239551,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6852,"completion_tokens":2,"total_tokens":6854,"cost":0.00377458,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0037686,"upstream_inference_completions_cost":0.00000598},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 1.8396965s + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 775 + host: "" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse bash to create a file named test.txt with content ''hello bash''\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":" test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":" bash"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":" bash"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761240020-U2deRmgGxMzG13VAViRs","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":141,"completion_tokens":9,"total_tokens":150,"cost":0.00003465,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002115,"upstream_inference_completions_cost":0.0000135},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 734.469ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 34444 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.bash:0","index":0,"type":"function","function":{"name":"bash","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"command"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"echo"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" bash"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"description"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Create"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" with"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" bash"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" content"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"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-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761240020-WdhCHWfrhSYpE2kTYfIR","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240020,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7732,"completion_tokens":36,"total_tokens":7768,"cost":0.00308388,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00301548,"upstream_inference_completions_cost":0.0000684},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 9.625613667s + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 34757 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.bash:0\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"`echo \\\\\\\"hello bash\\\\\\\" > test.txt`\\\",\\\"description\\\":\\\"Create test.txt file with hello bash content\\\"}\",\"name\":\"bash\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"functions.bash:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761240030-ZYVZpJzi3pYoH9VBYseP","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240030,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240030-ZYVZpJzi3pYoH9VBYseP","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240030,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761240030-ZYVZpJzi3pYoH9VBYseP","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240030,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7845,"completion_tokens":1,"total_tokens":7846,"cost":0.0039245,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0039225,"upstream_inference_completions_cost":0.000002},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 707.083875ms diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml index 6e7c6484d75e1a482bdefcf2bc7852f4b1eeb137..d76a59c6b3774e06d2617f03a0074934090ad2a5 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 788 + content_length: 824 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://httpbin.org/robots.txt and save it as robots.txt\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' headers: Accept: - application/json @@ -24,19 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220127-tE9zrDWy36dYAMdiFQDZ","provider":"Novita","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-tE9zrDWy36dYAMdiFQDZ","provider":"Novita","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":"Download"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-tE9zrDWy36dYAMdiFQDZ","provider":"Novita","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":" robots.txt from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":"Download"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-tE9zrDWy36dYAMdiFQDZ","provider":"Novita","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":" http"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-tE9zrDWy36dYAMdiFQDZ","provider":"Novita","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":"bin.org"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt from example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-tE9zrDWy36dYAMdiFQDZ","provider":"Novita","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":"-files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-tE9zrDWy36dYAMdiFQDZ","provider":"Novita","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":149,"completion_tokens":7,"total_tokens":156,"cost":0.00003285,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002235,"upstream_inference_completions_cost":0.0000105},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":".online-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":"convert.com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761240031-YtSA3oxylVX1fkgEXKma","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240031,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":150,"completion_tokens":11,"total_tokens":161,"cost":0.0000331,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000021,"upstream_inference_completions_cost":0.0000121},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -45,15 +51,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 741.712292ms + duration: 542.3845ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30005 + content_length: 34497 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -69,11 +75,93 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220127-P8hlVNqs8LbteZNNJujh","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.download:0","index":0,"type":"function","function":{"name":"download","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"url"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"https"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-files"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".online"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-con"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"vert"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".com"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/document"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-P8hlVNqs8LbteZNNJujh","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.download:0","function":{"arguments":"{\"file_path\": \"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/robots.txt\", \"url\": \"https://httpbin.org/robots.txt\"}","name":"download"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220127-P8hlVNqs8LbteZNNJujh","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220127,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7468,"completion_tokens":36,"total_tokens":7504,"cost":0.003806,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.003734,"upstream_inference_completions_cost":0.000072},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/download"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"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-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761240031-wdQxLaax3j9a23tD5TBT","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240032,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7740,"completion_tokens":51,"total_tokens":7791,"cost":0.0047715,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.004644,"upstream_inference_completions_cost":0.0001275},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -82,41 +170,160 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 590.544084ms + duration: 2.033601333s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/robots.txt + url: https://example-files.online-convert.com/document/txt/example.txt method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 30 - body: | - User-agent: * - Disallow: /deny + content_length: -1 + uncompressed: true + body: |- + TXT test file + Purpose: Provide example of this file type + Document file type: TXT + Version: 1.0 + Remark: + + Example content: + The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. + + John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. + + Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. + + + + File created by https://www.online-convert.com + More example files: https://www.online-convert.com/file-type + Text of Example content: Wikipedia (https://en.wikipedia.org/wiki/John_Doe) + License: Attribution-ShareAlike 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) + + Feel free to use and share the file according to the license above. headers: Content-Type: - - text/plain + - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 3.159789083s + duration: 256.336708ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30479 + content_length: 35025 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.download:0\",\"function\":{\"arguments\":\"{\\\"url\\\": \\\"https://example-files.online-convert.com/document/txt/example.txt\\\", \\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/example.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"functions.download:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":" File"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":" saved"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":" as"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:1","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"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-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"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-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"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-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/download"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"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-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761240034-C4VvTvHqixNbv0EHwNRk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240034,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7843,"completion_tokens":41,"total_tokens":7884,"cost":0.0048083,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0047058,"upstream_inference_completions_cost":0.0001025},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 990.821833ms +- id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 38129 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.download:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/robots.txt\\\", \\\"url\\\": \\\"https://httpbin.org/robots.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 30 bytes to /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/robots.txt (Content-Type: text/plain)\",\"tool_call_id\":\"functions.download:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.download:0\",\"function\":{\"arguments\":\"{\\\"url\\\": \\\"https://example-files.online-convert.com/document/txt/example.txt\\\", \\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/example.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"functions.download:0\",\"role\":\"tool\"},{\"content\":\"Done. File saved as example.txt.\",\"tool_calls\":[{\"id\":\"functions.view:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/example.txt\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|TXT test file\\n 2|Purpose: Provide example of this file type\\n 3|Document file type: TXT\\n 4|Version: 1.0\\n 5|Remark:\\n 6|\\n 7|Example content:\\n 8|The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.\\n 9|\\n 10|John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series.\\n 11|\\n 12|Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases.\\n 13|\\n 14|\\n 15|\\n 16|File created by https://www.online-convert.com\\n 17|More example files: https://www.online-convert.com/file-type\\n 18|Text of Example content: Wikipedia (https://en.wikipedia.org/wiki/John_Doe)\\n 19|License: Attribution-ShareAlike 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)\\n 20|\\n 21|Feel free to use and share the file according to the license above.\\n\\n\",\"tool_call_id\":\"functions.view:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -132,13 +339,39 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220132-JkmUEyIgU4JHAUiK8aZL","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220132,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":"File"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" text"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" about"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" John"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" placeholder"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" names"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":"21"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" lines"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":" total"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220132-JkmUEyIgU4JHAUiK8aZL","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220132,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220132-JkmUEyIgU4JHAUiK8aZL","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220132,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220132-JkmUEyIgU4JHAUiK8aZL","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220132,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7554,"completion_tokens":2,"total_tokens":7556,"cost":0.0045374,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0045324,"upstream_inference_completions_cost":0.000005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240035-0ePb6vtE6UULzp54p6uu","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240035,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8568,"completion_tokens":15,"total_tokens":8583,"cost":0.00475725,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0047124,"upstream_inference_completions_cost":0.00004485},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -147,4 +380,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 4.4081085s + duration: 943.673084ms diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml index eb1417996a57feb1c42c3452ed01ed79b8412889..048a66ef45cfefc7dd165374c4f4cc26b7ab9538 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 801 + content_length: 845 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://httpbin.org/html and tell me if it contains the word ''Herman''\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' headers: Accept: - application/json @@ -24,35 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":"Check"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":"Check"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":" if"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":" if"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":" https"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":"://"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":".html"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":"http"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":"bin"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":" John"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":".org"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":"/html"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":" word"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":" Herman"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761220136-Mu7F3XkI1jeGXwNzFmFC","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":148,"completion_tokens":13,"total_tokens":161,"cost":0.0000417,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000222,"upstream_inference_completions_cost":0.0000195},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240036-JKX4yVU7Oa9Y0GPXWc0r","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":155,"completion_tokens":8,"total_tokens":163,"cost":0.0000305,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000217,"upstream_inference_completions_cost":0.0000088},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -61,15 +51,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 658.333959ms + duration: 627.954916ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30015 + content_length: 34515 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -85,82 +75,55 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220136-XcNHjmV9JVq643s0XNe9","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-XcNHjmV9JVq643s0XNe9","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.fetch:0","function":{"arguments":"{\"format\": \".text\", \"url\": \"https://httpbin.org/html\"}","name":"fetch"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.fetch:0","index":0,"type":"function","function":{"name":"fetch","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220136-XcNHjmV9JVq643s0XNe9","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220136,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7471,"completion_tokens":16,"total_tokens":7487,"cost":0.0037675,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0037355,"upstream_inference_completions_cost":0.000032},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"url"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: [DONE] + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"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}]} - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 665.546417ms -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 30308 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.fetch:0\",\"function\":{\"arguments\":\"{\\\"format\\\": \\\".text\\\", \\\"url\\\": \\\"https://httpbin.org/html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Format must be one of: text, markdown, html\",\"tool_call_id\":\"functions.fetch:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"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-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.fetch:1","index":0,"type":"function","function":{"name":"fetch","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"https"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"format"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"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-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-files"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"text"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".online"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-con"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"vert"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"url"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".com"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"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-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"website"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"https"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/html"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"http"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".html"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"bin"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"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-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".org"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"format"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/html"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"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-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"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-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"text"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"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-1761220138-JFmDWWudGgefgweJl7na","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220139,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6857,"completion_tokens":27,"total_tokens":6884,"cost":0.0041817,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0041142,"upstream_inference_completions_cost":0.0000675},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761240036-JaM8Q5C9xrm5tlXLszkN","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240036,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7747,"completion_tokens":32,"total_tokens":7779,"cost":0.00308213,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00302133,"upstream_inference_completions_cost":0.0000608},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -169,53 +132,86 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.634766083s -- id: 3 + duration: 1.252252625s +- id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/html + url: https://example-files.online-convert.com/website/html/example.html method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 3741 + content_length: -1 + uncompressed: true body: |- + - - - -

Herman Melville - Moby-Dick

- -
-

- Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency. -

-
- + + +

HTML test file

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ + headers: Content-Type: - - text/html; charset=utf-8 + - text/html; charset=UTF-8 status: 200 OK code: 200 - duration: 1.956989167s -- id: 4 + duration: 51.40675ms +- id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 34153 + content_length: 37308 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.fetch:0\",\"function\":{\"arguments\":\"{\\\"format\\\": \\\".text\\\", \\\"url\\\": \\\"https://httpbin.org/html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Format must be one of: text, markdown, html\",\"tool_call_id\":\"functions.fetch:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.fetch:1\",\"function\":{\"arguments\":\"{\\\"format\\\": \\\"text\\\", \\\"url\\\": \\\"https://httpbin.org/html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Herman Melville - Moby-Dick Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency.\",\"tool_call_id\":\"functions.fetch:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.fetch:0\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/website/html/example.html\\\",\\\"format\\\":\\\"text\\\"}\",\"name\":\"fetch\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"tool_call_id\":\"functions.fetch:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -231,31 +227,33 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":"Yes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":"Yes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":" it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":" content"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":" word"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":" words"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":" '"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":"H"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":"John"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":"erman"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":"'"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":"\"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220142-p99WbmTME6QMWAONZHWt","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220142,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8393,"completion_tokens":11,"total_tokens":8404,"cost":0.0050633,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0050358,"upstream_inference_completions_cost":0.0000275},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240038-HbzsRBI0rrzr0vsZSyaS","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240038,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8347,"completion_tokens":12,"total_tokens":8359,"cost":0.0050382,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0050082,"upstream_inference_completions_cost":0.00003},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -264,4 +262,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 4.635297416s + duration: 924.71225ms diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml index 41af7e8a481cb6722509a68f1d932f73a8ab64a6..338710de6751defbd09bc02eb30d61ab55822789 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml @@ -24,19 +24,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220147-yrFSxn0jeR2lqTpz982z","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220147-yrFSxn0jeR2lqTpz982z","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":"Find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":"Find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220147-yrFSxn0jeR2lqTpz982z","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":" all .go files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" all"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220147-yrFSxn0jeR2lqTpz982z","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":" in current directory using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220147-yrFSxn0jeR2lqTpz982z","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":" glob"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220147-yrFSxn0jeR2lqTpz982z","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220147-yrFSxn0jeR2lqTpz982z","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":139,"completion_tokens":11,"total_tokens":150,"cost":0.00003405,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002085,"upstream_inference_completions_cost":0.0000132},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":" glob"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761240039-xwnaz8zuYmep4mFNK9ng","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":139,"completion_tokens":11,"total_tokens":150,"cost":0.0000227,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000139,"upstream_inference_completions_cost":0.0000088},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -45,15 +57,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 443.75725ms + duration: 967.754708ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29977 + content_length: 34433 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -69,23 +81,27 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + + data: {"id":"gen-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.glob:0","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + + data: {"id":"gen-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.glob:0","index":0,"type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"\":\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"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-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"*."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"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-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"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-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"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-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.glob:1","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761220147-NO5RY2T5TA4WqVVjNLLw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220147,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6794,"completion_tokens":16,"total_tokens":6810,"cost":0.0041164,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0040764,"upstream_inference_completions_cost":0.00004},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240039-pO8dWej7GRMhrVzi0Lbl","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240039,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7807,"completion_tokens":15,"total_tokens":7822,"cost":0.0031528,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0031228,"upstream_inference_completions_cost":0.00003},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -94,15 +110,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.073430625s + duration: 3.852134417s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30252 + content_length: 34707 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool/main.go\",\"tool_call_id\":\"functions.glob:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool/main.go\",\"tool_call_id\":\"functions.glob:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -118,11 +134,15 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220148-8aGcfYUfCElMFLprwIW6","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220148,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240045-Oy277zb1mJm4VwD5icgw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240045,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240045-Oy277zb1mJm4VwD5icgw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240045,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240045-Oy277zb1mJm4VwD5icgw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240045,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220148-8aGcfYUfCElMFLprwIW6","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220148,"choices":[{"index":0,"delta":{"role":"assistant","content":"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool/main.go"},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240045-Oy277zb1mJm4VwD5icgw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240045,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220148-8aGcfYUfCElMFLprwIW6","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220148,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6902,"completion_tokens":18,"total_tokens":6920,"cost":0.003487,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.003451,"upstream_inference_completions_cost":0.000036},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240045-Oy277zb1mJm4VwD5icgw","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240045,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7779,"completion_tokens":3,"total_tokens":7782,"cost":0.0046749,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0046674,"upstream_inference_completions_cost":0.0000075},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -131,4 +151,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 644.354708ms + duration: 993.985ms diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml index 42ef2382efc8d3705e0c152263139cae83e732bf..c8bf7b65d820ae5e94cc17ad87392f56ac22a053 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml @@ -24,19 +24,17 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220149-7J9TfUlbjCYqpFghw9UA","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-uGI7ZpLlgL2mBGsQpF9x","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761220149-7J9TfUlbjCYqpFghw9UA","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-uGI7ZpLlgL2mBGsQpF9x","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761220149-7J9TfUlbjCYqpFghw9UA","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-uGI7ZpLlgL2mBGsQpF9x","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":" for package in go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761220149-7J9TfUlbjCYqpFghw9UA","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":" for package in Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-uGI7ZpLlgL2mBGsQpF9x","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":" files using grep"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761220149-7J9TfUlbjCYqpFghw9UA","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":" files using grep"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-uGI7ZpLlgL2mBGsQpF9x","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761220149-7J9TfUlbjCYqpFghw9UA","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761220149-7J9TfUlbjCYqpFghw9UA","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":140,"completion_tokens":9,"total_tokens":149,"cost":0.0000295,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000196,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240046-uGI7ZpLlgL2mBGsQpF9x","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":144,"completion_tokens":8,"total_tokens":152,"cost":0.000088,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000072,"upstream_inference_completions_cost":0.000016},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -45,15 +43,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 303.891625ms + duration: 1.865081292s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29975 + content_length: 34431 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -69,37 +67,37 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.grep:0","index":0,"type":"function","function":{"name":"grep","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"grep:0","type":"function","function":{"name":"grep"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"package"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"package"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"include"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"include"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \"*."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"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-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220149-0vCUfPBSRCS3h7qNhgPs","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220149,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6795,"completion_tokens":24,"total_tokens":6819,"cost":0.00269565,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00265005,"upstream_inference_completions_cost":0.0000456},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240046-LNWBsXd9j1CnUfwJdEyB","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240046,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8388,"completion_tokens":22,"total_tokens":8410,"cost":0.0050878,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0050328,"upstream_inference_completions_cost":0.000055},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -108,15 +106,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 920.239083ms + duration: 2.52063025s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30329 + content_length: 34764 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.grep:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\".*package.*\\\",\\\"include\\\":\\\"*.go\\\"}\",\"name\":\"grep\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"functions.grep:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"grep:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"package\\\", \\\"include\\\": \\\"*.go\\\"}\",\"name\":\"grep\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"grep:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -132,35 +130,47 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":" '"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"package"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"'"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":" match"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":"package"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"package"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220150-GbZ5zd1G2tyyDqd4dYyy","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220150,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6872,"completion_tokens":13,"total_tokens":6885,"cost":0.00270478,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00268008,"upstream_inference_completions_cost":0.0000247},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240049-gnN1MF44nJnjCdFMBOh8","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240049,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7802,"completion_tokens":19,"total_tokens":7821,"cost":0.00307888,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00304278,"upstream_inference_completions_cost":0.0000361},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -169,4 +179,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 3.372464917s + duration: 1.099347709s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml index 3a811b2b109c7b4b7b0acf248b83eef12a97463d..037d832555ee0b8b325b299785f075bd49779c32 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml @@ -24,19 +24,17 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220154-2UqtOzAtoy23ybbCDhgp","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240050-1oheeHL70ECf6kcayOT8","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220154-2UqtOzAtoy23ybbCDhgp","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":"List"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240050-1oheeHL70ECf6kcayOT8","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":"List"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220154-2UqtOzAtoy23ybbCDhgp","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":" files in current directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240050-1oheeHL70ECf6kcayOT8","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":" files in current directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220154-2UqtOzAtoy23ybbCDhgp","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240050-1oheeHL70ECf6kcayOT8","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":" using ls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220154-2UqtOzAtoy23ybbCDhgp","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":" ls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240050-1oheeHL70ECf6kcayOT8","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220154-2UqtOzAtoy23ybbCDhgp","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761220154-2UqtOzAtoy23ybbCDhgp","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":137,"completion_tokens":8,"total_tokens":145,"cost":0.00003015,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002055,"upstream_inference_completions_cost":0.0000096},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240050-1oheeHL70ECf6kcayOT8","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":137,"completion_tokens":8,"total_tokens":145,"cost":0.00003015,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002055,"upstream_inference_completions_cost":0.0000096},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -45,15 +43,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 452.08625ms + duration: 850.238458ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29969 + content_length: 34425 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -69,53 +67,55 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"ls:0","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.ls:0","index":0,"type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"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-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"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-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"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-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ls"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ls"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"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-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220154-2jRV59AxErw9p37yCN59","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220154,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6792,"completion_tokens":32,"total_tokens":6824,"cost":0.00270968,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00264888,"upstream_inference_completions_cost":0.0000608},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240051-PSvwk7WPWDMTZvdY0Ces","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240051,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8385,"completion_tokens":31,"total_tokens":8416,"cost":0.00133525,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8385,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00125775,"upstream_inference_completions_cost":0.0000775},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -124,15 +124,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.121841625s + duration: 2.574049333s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30309 + content_length: 34746 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.ls:0\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\\"}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"functions.ls:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"ls:0\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\\"}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"ls:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -148,21 +148,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220157-ngf8iEkZSJ0RaCEBZGhw","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220157,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6869,"completion_tokens":6,"total_tokens":6875,"cost":0.00379589,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00377795,"upstream_inference_completions_cost":0.00001794},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240054-wxZrF0q8Ts2nxJMAU5ox","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240054,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8462,"completion_tokens":6,"total_tokens":8468,"cost":0.0012843,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8462,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0012693,"upstream_inference_completions_cost":0.000015},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -171,4 +171,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.038783667s + duration: 2.348917917s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml index b95ebcfb405db1c8e5c968a4a540515fabe3ff5e..a1a63784632d697e125680b423d9da728f1b8f74 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml @@ -24,37 +24,37 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":"Use"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":"Use"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" mult"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" mult"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":"ied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":"ied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":"it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":"it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" update"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" update"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" add"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" add"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220158-JV8yYutHEaAKsY4jNUnm","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":160,"completion_tokens":14,"total_tokens":174,"cost":0.000045,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000024,"upstream_inference_completions_cost":0.000021},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240056-6RjBxoO0JRIMocOsTJw1","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":160,"completion_tokens":14,"total_tokens":174,"cost":0.0000272,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000016,"upstream_inference_completions_cost":0.0000112},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -63,15 +63,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 648.632417ms + duration: 1.011086584s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30055 + content_length: 34511 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -87,13 +87,63 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220158-FY9L7bXk3wwCeduthrTk","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220158-FY9L7bXk3wwCeduthrTk","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll help you make those changes to main.go using multiedit. Let me first read the file to see its current contents."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"view:0","type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220158-FY9L7bXk3wwCeduthrTk","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","function":{"arguments":"{\"file_path\": \"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\"}","name":"view"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220158-FY9L7bXk3wwCeduthrTk","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220158,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7481,"completion_tokens":53,"total_tokens":7534,"cost":0.0038465,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0037405,"upstream_inference_completions_cost":0.000106},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"file"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/mult"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ied"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"it"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240056-hRB8NT9PbvL2czjLKskB","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240056,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8409,"completion_tokens":34,"total_tokens":8443,"cost":0.001444,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001359,"upstream_inference_completions_cost":0.000085},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -102,15 +152,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 647.317792ms + duration: 2.999908167s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30614 + content_length: 34921 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I'll help you make those changes to main.go using multiedit. Let me first read the file to see its current contents.\",\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -126,207 +176,157 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"Now"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" I'll"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" use"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" mult"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"ied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" make"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" both"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"multiedit:1","type":"function","function":{"name":"multiedit","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"file"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" replace"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" '"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" World"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"!'"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" '"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"!'"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" add"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" a"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" above"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/mult"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ied"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"it"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":".Println"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":" line"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.multiedit:0","index":0,"type":"function","function":{"name":"multiedit","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ed"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"its"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" [\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" {\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"old"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_string"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tf"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"mt"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".Println"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"(\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/mult"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Hello"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ied"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"it"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" World"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"!\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\")"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\",\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ed"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"new"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"its"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_string"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"old"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"t"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"//"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" G"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"reeting"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tf"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"mt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\t"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"fmt"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".Println"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"(\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Hello"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" World"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" Crush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"!\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\")"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"new"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" }\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"]}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"t"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" G"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"reeting"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\n"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\t"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"fmt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" Crush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"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-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - - data: {"id":"gen-1761220160-LU2nGVoPutn6Q02vzowr","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220160,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6944,"completion_tokens":110,"total_tokens":7054,"cost":0.0041481,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0038192,"upstream_inference_completions_cost":0.0003289},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240060-B6ZgNF5VoPGHXPhn8gbP","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240060,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8511,"completion_tokens":83,"total_tokens":8594,"cost":0.0016277,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0014202,"upstream_inference_completions_cost":0.0002075},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -335,15 +335,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 900.6645ms + duration: 3.047699125s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31325 + content_length: 35485 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I'll help you make those changes to main.go using multiedit. Let me first read the file to see its current contents.\",\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"content\":\"Now I'll use multiedit to make both changes: replace 'Hello, World!' with 'Hello, Crush!' and add a comment above the fmt.Println line.\",\"tool_calls\":[{\"id\":\"functions.multiedit:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\", \\\"edits\\\": [{\\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\", \\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"functions.multiedit:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"view:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"multiedit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\", \\\"edits\\\": [\\n {\\n \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\n \\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"\\n }\\n]}\",\"name\":\"multiedit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"multiedit:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -359,33 +359,63 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" now"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" has"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" prints"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":"!\""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" instead"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":" have"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" of"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":" been"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":" applied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":" World"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":"\"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220163-pY7lkXpF7snLvMpKFTY6","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220163,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7105,"completion_tokens":12,"total_tokens":7117,"cost":0.00279375,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00277095,"upstream_inference_completions_cost":0.0000228},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240067-U6TToIz3FhN8wpLljy3j","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240067,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8646,"completion_tokens":27,"total_tokens":8673,"cost":0.0014535,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8448,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001386,"upstream_inference_completions_cost":0.0000675},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -394,4 +424,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 10.067079875s + duration: 2.376332417s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml index b257db30951e859fcfd5cc50218280f1abc11de7..2f85b72eb21da4979b4e603eee4c8ae063adf11a 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml @@ -1,196 +1,210 @@ --- version: 2 interactions: -- id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 843 - host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' - 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-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":"Run"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" glob"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" ls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" parallel"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" list"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761239569-950BMmc623ypylMmxjYk","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":156,"completion_tokens":15,"total_tokens":171,"cost":0.00003834,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002184,"upstream_inference_completions_cost":0.0000165},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 843 + host: "" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + 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-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 836.143666ms -- id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 30066 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":"Run"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.glob:0","index":0,"type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" glob"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"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-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" ls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"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-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"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-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" parallel"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"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-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.ls:1","index":1,"type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":1,"type":"function","function":{"name":null,"arguments":"{}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761239569-wWYt1fKl6idcYe2RY4kq","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239569,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6812,"completion_tokens":25,"total_tokens":6837,"cost":0.0041497,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0040872,"upstream_inference_completions_cost":0.0000625},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: [DONE] + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" list"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761240086-ELazlLg2h8fYGrCYUcbZ","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":156,"completion_tokens":15,"total_tokens":171,"cost":0.0000276,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000156,"upstream_inference_completions_cost":0.000012},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 2.4270345s -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 30597 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"functions.ls:1\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/main.go\",\"tool_call_id\":\"functions.glob:0\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"functions.ls:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 709.797333ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 34522 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"glob:0","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"pattern"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"**"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/*."},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"id":"ls:1","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":"Current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":" \".\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240086-sqzzWRYAAnHK6ULZnRg8","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240086,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8405,"completion_tokens":29,"total_tokens":8434,"cost":0.0014291,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0013566,"upstream_inference_completions_cost":0.0000725},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: [DONE] - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 3.062858709s + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 35031 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"ls:1\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\"}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/main.go\",\"tool_call_id\":\"glob:0\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"ls:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761239572-yZ0N8Cb5cvwdFuZS2wgs","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239572,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6991,"completion_tokens":19,"total_tokens":7010,"cost":0.0028344,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0027964,"upstream_inference_completions_cost":0.000038},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: [DONE] + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 4.087666916s + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"`\n\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"Directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":" contents"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":" go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240090-ukMQ6juRdMev7eiIhvEV","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240090,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8512,"completion_tokens":21,"total_tokens":8533,"cost":0.0014733,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0014208,"upstream_inference_completions_cost":0.0000525},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 3.759316542s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml index b47dc4117d3c667e18e940393498a00de48ff9eb..8b3a45efe534b080830cbf3caead07f20ef992c1 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml @@ -24,15 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220108-0EjD4tDrkLa0XzPbiZmz","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239999-iOhpurfzMWJziAZfXPX0","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-0EjD4tDrkLa0XzPbiZmz","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":"Read"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239999-iOhpurfzMWJziAZfXPX0","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":"Read"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-0EjD4tDrkLa0XzPbiZmz","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":" the go mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239999-iOhpurfzMWJziAZfXPX0","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-0EjD4tDrkLa0XzPbiZmz","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761239999-iOhpurfzMWJziAZfXPX0","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":" go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-0EjD4tDrkLa0XzPbiZmz","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":131,"completion_tokens":5,"total_tokens":136,"cost":0.00002565,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00001965,"upstream_inference_completions_cost":0.000006},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761239999-iOhpurfzMWJziAZfXPX0","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":" mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761239999-iOhpurfzMWJziAZfXPX0","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761239999-iOhpurfzMWJziAZfXPX0","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":131,"completion_tokens":5,"total_tokens":136,"cost":0.0000171,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000131,"upstream_inference_completions_cost":0.000004},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -41,15 +45,64 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 848.267167ms + duration: 812.326ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29939 + content_length: 34395 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.glob:0","index":0,"type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"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-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"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-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".mod"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"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-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761239999-e5qOEy7t8SX2Grpin1F1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239999,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7722,"completion_tokens":16,"total_tokens":7738,"cost":0.00304198,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00301158,"upstream_inference_completions_cost":0.0000304},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.548595166s +- id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 34672 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"go.mod\\\"}\",\"name\":\"glob\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/go.mod\",\"tool_call_id\":\"functions.glob:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -65,59 +118,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:0","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:1","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"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-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"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-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"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-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"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-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"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-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"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-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/read"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/read"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"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-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"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-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"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-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"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-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".mod"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".mod"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"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-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"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-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - data: {"id":"gen-1761220108-B6pksThILk4jIPez3nv5","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220108,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6786,"completion_tokens":34,"total_tokens":6820,"cost":0.0041566,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0040716,"upstream_inference_completions_cost":0.000085},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240002-29EQQ6k6skVAG1JNjPyt","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240003,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7772,"completion_tokens":34,"total_tokens":7806,"cost":0.00309568,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00303108,"upstream_inference_completions_cost":0.0000646},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -126,15 +179,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 957.780292ms -- id: 2 + duration: 3.574283125s +- id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30294 + content_length: 35026 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"go.mod\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/go.mod\",\"tool_call_id\":\"functions.glob:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.view:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"functions.view:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -150,39 +203,39 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":"Module"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"```\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"module"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":"/test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"/test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":"project"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"project"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":" \n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":"Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":" version"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"23"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":"23"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":"```"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220109-dSYhAmctHxTEXpEE3VzB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220109,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6864,"completion_tokens":15,"total_tokens":6879,"cost":0.00270546,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00267696,"upstream_inference_completions_cost":0.0000285},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240006-LKbGo8dmoOxobSUlB8X1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240006,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7850,"completion_tokens":15,"total_tokens":7865,"cost":0.00309,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0030615,"upstream_inference_completions_cost":0.0000285},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -191,4 +244,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.810485583s + duration: 5.008051083s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml index a828f15ace78b6d41cc9cdef21a28112a79ac1f4..f9edde258e39e61b5794ca716a3034ba93ab63ec 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml @@ -24,13 +24,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220102-lAH9RiaVfSeyDpWZLKK8","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220102,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239997-XpZqKcTAIccM0wehg9On","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220102-lAH9RiaVfSeyDpWZLKK8","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220102,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239997-XpZqKcTAIccM0wehg9On","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220102-lAH9RiaVfSeyDpWZLKK8","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220102,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761239997-XpZqKcTAIccM0wehg9On","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220102-lAH9RiaVfSeyDpWZLKK8","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220102,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":128,"completion_tokens":2,"total_tokens":130,"cost":0.0000222,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000192,"upstream_inference_completions_cost":0.000003},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761239997-XpZqKcTAIccM0wehg9On","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":128,"completion_tokens":2,"total_tokens":130,"cost":0.0000222,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000192,"upstream_inference_completions_cost":0.000003},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -39,15 +39,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 945.429916ms + duration: 1.242740542s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29929 + content_length: 34385 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Hello\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Hello\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -63,15 +63,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220102-X6GOhnHvFNCvGA4GyPy1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220103,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239997-3iOwxckQs3dLbysDASrV","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220102-X6GOhnHvFNCvGA4GyPy1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220103,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hey"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239997-3iOwxckQs3dLbysDASrV","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hi"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220102-X6GOhnHvFNCvGA4GyPy1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220103,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761239997-3iOwxckQs3dLbysDASrV","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220102-X6GOhnHvFNCvGA4GyPy1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220103,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761220102-X6GOhnHvFNCvGA4GyPy1","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220103,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6782,"completion_tokens":3,"total_tokens":6785,"cost":0.00265068,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00264498,"upstream_inference_completions_cost":0.0000057},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761239997-3iOwxckQs3dLbysDASrV","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761239997,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7718,"completion_tokens":2,"total_tokens":7720,"cost":0.0046358,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0046308,"upstream_inference_completions_cost":0.000005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -80,4 +78,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 6.097041958s + duration: 2.161086041s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml index 3226f5f66275907a2df94bbc021c547ccc9231e1..f36765539175c450b623292cd7864bdc029c7396 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29989 + content_length: 769 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse sourcegraph to search for ''func main'' in Go repositories\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' headers: Accept: - application/json @@ -24,11 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220176-hQWMQJT75aYKMrIpNzfr","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":" for func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":" main in Go repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":" using Source"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":"graph"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220176-hQWMQJT75aYKMrIpNzfr","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.sourcegraph:0","function":{"arguments":"{\"query\": \"func main lang:go\", \"timeout\": 30}","name":"sourcegraph"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220176-hQWMQJT75aYKMrIpNzfr","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7464,"completion_tokens":15,"total_tokens":7479,"cost":0.003762,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.003732,"upstream_inference_completions_cost":0.00003},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240070-6Trj70B5ufAUX12xqLPF","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240070,"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.0000342,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000021,"upstream_inference_completions_cost":0.0000132},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -37,15 +47,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 621.638291ms + duration: 786.188083ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 769 + content_length: 34445 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse sourcegraph to search for ''func main'' in Go repositories\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -61,19 +71,45 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220176-C539TimwBBkELBXM2Jvu","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"sourcegraph:0","type":"function","function":{"name":"sourcegraph","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"query"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220176-C539TimwBBkELBXM2Jvu","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"func"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220176-C539TimwBBkELBXM2Jvu","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":" for func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220176-C539TimwBBkELBXM2Jvu","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":" main in Go repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" lang"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220176-C539TimwBBkELBXM2Jvu","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":" using Sourcegraph"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220176-C539TimwBBkELBXM2Jvu","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220176-C539TimwBBkELBXM2Jvu","provider":"Alibaba","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220176,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":144,"completion_tokens":10,"total_tokens":154,"cost":0.000092,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000072,"upstream_inference_completions_cost":0.00002},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"count"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"10"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240070-PNn6yUUl0Z8tPHZCI05I","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8388,"completion_tokens":26,"total_tokens":8414,"cost":0.0014114,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0013464,"upstream_inference_completions_cost":0.000065},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -82,7 +118,7 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.587788291s + duration: 2.527148666s - id: 2 request: proto: HTTP/1.1 @@ -110,15 +146,15 @@ interactions: - application/json status: 200 OK code: 200 - duration: 1.473759417s + duration: 1.426158625s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 37787 + content_length: 42221 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:0\",\"function\":{\"arguments\":\"{\\\"query\\\": \\\"func main lang:go\\\", \\\"timeout\\\": 30}\",\"name\":\"sourcegraph\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n```\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| \\tFuncB()\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n```\\n\\n```\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tfmt.Println(\\\"FuncA\\\")\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n```\\n\\n```\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| func FuncF() {\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n```\\n\\n```\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| \\tfmt.Println(\\\"FuncF\\\")\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n```\\n\\n```\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tFuncE()\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n```\\n\\n\",\"tool_call_id\":\"functions.sourcegraph:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"sourcegraph:0\",\"function\":{\"arguments\":\"{\\\"query\\\": \\\"func main lang:go\\\", \\\"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/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n```\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| \\tFuncB()\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n```\\n\\n```\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tfmt.Println(\\\"FuncA\\\")\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n```\\n\\n```\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| func FuncF() {\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n```\\n\\n```\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| \\tfmt.Println(\\\"FuncF\\\")\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n```\\n\\n```\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tFuncE()\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n```\\n\\n\",\"tool_call_id\":\"sourcegraph:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -134,37 +170,99 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"30"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" matches"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" across"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"30"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" results"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" show"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" various"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" programs"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" functions"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" including"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" a"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" simple"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" program"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" function"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" call"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" chains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" ("},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"Func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"A"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" calls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" Func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":"30"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"B"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" matches"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" etc"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":".)"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":"func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" us"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"c"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"ope"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":" repository"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220178-WtqDOT0gHmKlmZq9lgiE","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220179,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9625,"completion_tokens":14,"total_tokens":9639,"cost":0.00378035,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00375375,"upstream_inference_completions_cost":0.0000266},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240075-xqJnRQjE4bDdTRw68iZR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240075,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11218,"completion_tokens":45,"total_tokens":11263,"cost":0.0031569,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0030444,"upstream_inference_completions_cost":0.0001125},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -173,4 +271,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 3.359791375s + duration: 2.654150958s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml index c7b0f095208581b069359c6a0b67827612d1a1c2..1c6e2c57a97ebfe4ba74d3dd790ce6e5457e06a6 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml @@ -24,21 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240011-MretyGobJMafKIgxYhE1","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240011,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240011-MretyGobJMafKIgxYhE1","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240011,"choices":[{"index":0,"delta":{"role":"assistant","content":"Update"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":"Update"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240011-MretyGobJMafKIgxYhE1","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240011,"choices":[{"index":0,"delta":{"role":"assistant","content":" main.go to print"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" main.go to print"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240011-MretyGobJMafKIgxYhE1","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240011,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240011-MretyGobJMafKIgxYhE1","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240011,"choices":[{"index":0,"delta":{"role":"assistant","content":" from crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" from crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240011-MretyGobJMafKIgxYhE1","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240011,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761220113-Wrx6uMbFFu3R2urMKV6Z","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":141,"completion_tokens":9,"total_tokens":150,"cost":0.00002964,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00001974,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240011-MretyGobJMafKIgxYhE1","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240011,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":141,"completion_tokens":9,"total_tokens":150,"cost":0.00003465,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002115,"upstream_inference_completions_cost":0.0000135},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -47,15 +45,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 624.237417ms + duration: 844.887417ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29995 + content_length: 34451 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -71,95 +69,96 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" update"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" change"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" print"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" statement"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" say"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.read:0","index":0,"type":"function","function":{"name":"read","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":"hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":" crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":"\"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:0","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"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-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"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-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"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-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/update"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/update"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240012-tsWEn3YnkJbDYFgvMbPs","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240012,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7732,"completion_tokens":34,"total_tokens":7766,"cost":0.0047242,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0046392,"upstream_inference_completions_cost":0.000085},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"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-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"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: [DONE] - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"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}]} + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.616297542s +- id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 34748 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.read:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"read\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"tool not found: read\",\"tool_call_id\":\"functions.read:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761240014-oboFzbAFzteBaatOe6g9","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240014,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240014-oboFzbAFzteBaatOe6g9","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240014,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:1","function":{"arguments":"{\"file_path\": \"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\"}","name":"view"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - data: {"id":"gen-1761220113-apLixMr8FGr5Ev9pzoOA","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6796,"completion_tokens":52,"total_tokens":6848,"cost":0.00389328,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0037378,"upstream_inference_completions_cost":0.00015548},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240014-oboFzbAFzteBaatOe6g9","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240014,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8648,"completion_tokens":24,"total_tokens":8672,"cost":0.004372,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.004324,"upstream_inference_completions_cost":0.000048},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -168,15 +167,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.70994525s -- id: 2 + duration: 715.038875ms +- id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30524 + content_length: 35177 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"I'll update the main.go file to change the print statement to say \\\"hello from crush\\\".\",\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.read:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"read\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"tool not found: read\",\"tool_call_id\":\"functions.read:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.view:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -192,11 +191,117 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220116-MbBlCYI3Ib7M68BgQ1xG","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.edit:2","index":0,"type":"function","function":{"name":"edit","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220116-MbBlCYI3Ib7M68BgQ1xG","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.edit:1","function":{"arguments":"{\"file_path\": \"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\", \"new_string\": \"\\tfmt.Println(\\\"hello from crush\\\")\", \"old_string\": \"\\tfmt.Println(\\\"Hello, World!\\\")\"}","name":"edit"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220116-MbBlCYI3Ib7M68BgQ1xG","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7558,"completion_tokens":50,"total_tokens":7608,"cost":0.003879,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.003779,"upstream_inference_completions_cost":0.0001},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/update"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"old"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tf"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"mt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" World"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"new"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tf"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"mt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" from"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" Crush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"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-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761240015-3gcidKuQ0jvLJivvDL7u","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240016,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7887,"completion_tokens":63,"total_tokens":7950,"cost":0.0048897,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0047322,"upstream_inference_completions_cost":0.0001575},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -205,15 +310,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 563.736458ms -- id: 3 + duration: 2.067215292s +- id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31042 + content_length: 35695 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"I'll update the main.go file to change the print statement to say \\\"hello from crush\\\".\",\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.edit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\", \\\"new_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\", \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"functions.edit:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.read:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"read\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"tool not found: read\",\"tool_call_id\":\"functions.read:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.view:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:1\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.edit:2\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\", \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\", \\\"new_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello from Crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"functions.edit:2\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -229,11 +334,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220119-1hhXvYSZqfvdqKqwAX8t","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220119,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240018-ROGg2YsczUJvKNkfGZdS","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240018,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761240018-ROGg2YsczUJvKNkfGZdS","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240018,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220119-1hhXvYSZqfvdqKqwAX8t","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220119,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done. The main.go file has been updated to print \"hello from crush\" instead of \"Hello, World!\"."},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240018-ROGg2YsczUJvKNkfGZdS","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240018,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220119-1hhXvYSZqfvdqKqwAX8t","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220119,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7087,"completion_tokens":24,"total_tokens":7111,"cost":0.0035915,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0035435,"upstream_inference_completions_cost":0.000048},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240018-ROGg2YsczUJvKNkfGZdS","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240018,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7996,"completion_tokens":2,"total_tokens":7998,"cost":0.00440378,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0043978,"upstream_inference_completions_cost":0.00000598},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -242,4 +349,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.0650975s + duration: 1.713110333s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml index 6d801d0727651a63b742237cd3ac09221b6bbe18..260a0de7015aacf06b9b13a1bd0e82c2024e2577 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml @@ -24,27 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":" config"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":" config"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":".json"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":".json"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":" name"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":" sample"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":" JSON"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":" version"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":" content"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":" data"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761220182-Ly7xf4NcMn3U6zGvTjEY","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761220182,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":155,"completion_tokens":9,"total_tokens":164,"cost":0.0000227,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000155,"upstream_inference_completions_cost":0.0000072},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240079-7CZ6wA5XHiUJfGUfEKpD","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761240079,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":155,"completion_tokens":8,"total_tokens":163,"cost":0.00003525,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002325,"upstream_inference_completions_cost":0.000012},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -53,15 +51,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 727.070833ms + duration: 820.862541ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30032 + content_length: 34488 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -77,29 +75,101 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"write:0","type":"function","function":{"name":"write","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"file"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.write:0","index":0,"type":"function","function":{"name":"write","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"file_path\": \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/write"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp/crush-test/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"CoderAgent/openrouter-kimi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/config"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k2/write_tool/config.json"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".json"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\", \"content\": \"{\\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"name\\\": \\\"test\\\", \\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"version\\\": \\\"1.0"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"content"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".0\\\"}\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"{\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220182-2qbxH13DQWlRezpT3GNS","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220195,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":7121,"completion_tokens":54,"total_tokens":7175,"cost":0.007283,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.007121,"upstream_inference_completions_cost":0.000162},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"name"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"version"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"1"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"."},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"0"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"."},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"0"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"}\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240080-sp8BrHuZq47UhXKxoUJS","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240080,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8403,"completion_tokens":53,"total_tokens":8456,"cost":0.0014879,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0013554,"upstream_inference_completions_cost":0.0001325},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -108,15 +178,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 10.056503417s + duration: 2.709889709s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30512 + content_length: 34948 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.write:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\\", \\\"content\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\n\",\"tool_call_id\":\"functions.write:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"write:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\\", \\\"content\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\n\",\"tool_call_id\":\"write:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -132,13 +202,15 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761220197-yPnCmFE0VtmA0OqgD0EY","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220197,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240084-2GqyqSDQix5sn7TbnOvv","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240084,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761240084-2GqyqSDQix5sn7TbnOvv","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240084,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220197-yPnCmFE0VtmA0OqgD0EY","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220197,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761240084-2GqyqSDQix5sn7TbnOvv","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240084,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220197-yPnCmFE0VtmA0OqgD0EY","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220197,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761240084-2GqyqSDQix5sn7TbnOvv","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240084,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761220197-yPnCmFE0VtmA0OqgD0EY","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761220197,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":6908,"completion_tokens":2,"total_tokens":6910,"cost":0.00269792,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00269412,"upstream_inference_completions_cost":0.0000038},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761240084-2GqyqSDQix5sn7TbnOvv","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761240084,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":8501,"completion_tokens":3,"total_tokens":8504,"cost":0.0014217,"is_byok":false,"prompt_tokens_details":{"cached_tokens":8192,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0014142,"upstream_inference_completions_cost":0.0000075},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -147,4 +219,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.886751625s + duration: 1.954985542s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml index 55aaf6df9b562a426d7a5eedbf031d2e65838cb4..d1b540fac9d3c4dcd0ba123a238ddf14ebb13852 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml @@ -24,19 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193928989e697aa43b43f3","created":1761219568,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193928989e697aa43b43f3","created":1761219568,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Create"}}]} + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"B"}}]} - data: {"id":"20251023193928989e697aa43b43f3","created":1761219568,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"ash"}}]} - data: {"id":"20251023193928989e697aa43b43f3","created":1761219568,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"20251023193928989e697aa43b43f3","created":1761219568,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" bash"}}]} + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" creation"}}]} - data: {"id":"20251023193928989e697aa43b43f3","created":1761219568,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" command"}}]} + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251023193928989e697aa43b43f3","created":1761219568,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":134,"completion_tokens":9,"total_tokens":143,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} + + data: {"id":"2025102401223263aa65cb22804bd6","created":1761240152,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":134,"completion_tokens":10,"total_tokens":144,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -45,15 +47,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 768.768125ms + duration: 626.4255ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29865 + content_length: 34321 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,13 +71,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939288ec9133e11754a76","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401223247f76266adba41ad","created":1761240152,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939288ec9133e11754a76","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401223247f76266adba41ad","created":1761240152,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939288ec9133e11754a76","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_63cd782359bd4caba1cd9670","index":0,"type":"function","function":{"name":"bash","arguments":"{\"command\":\"echo 'hello bash' > test.txt\",\"description\":\"Create test.txt file with content 'hello bash'\"}"}}]}}]} + data: {"id":"2025102401223247f76266adba41ad","created":1761240152,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_334dd50b3c874816ad43be7f","index":0,"type":"function","function":{"name":"bash","arguments":"{\"command\":\"echo 'hello bash' > test.txt\",\"description\":\"Create test.txt with content 'hello bash'\"}"}}]}}]} - data: {"id":"202510231939288ec9133e11754a76","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7195,"completion_tokens":41,"total_tokens":7236,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"2025102401223247f76266adba41ad","created":1761240152,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8145,"completion_tokens":40,"total_tokens":8185,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -84,15 +86,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 748.330209ms + duration: 661.87475ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30215 + content_length: 34666 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_63cd782359bd4caba1cd9670\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"echo 'hello bash' > test.txt\\\",\\\"description\\\":\\\"Create test.txt file with content 'hello bash'\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_63cd782359bd4caba1cd9670\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_334dd50b3c874816ad43be7f\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"echo 'hello bash' > test.txt\\\",\\\"description\\\":\\\"Create test.txt with content 'hello bash'\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_334dd50b3c874816ad43be7f\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -108,52 +110,33 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939304635f9016a6e4024","created":1761219570,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939304635f9016a6e4024","created":1761219570,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939304635f9016a6e4024","created":1761219570,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_46448734c82c4f1aac496ab3","index":0,"type":"function","function":{"name":"bash","arguments":"{\"command\":\"cat test.txt\",\"description\":\"Verify test.txt content\"}"}}]}}]} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} - data: {"id":"202510231939304635f9016a6e4024","created":1761219570,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7244,"completion_tokens":30,"total_tokens":7274,"prompt_tokens_details":{"cached_tokens":7235}}} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: [DONE] + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Created"}}]} - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 709.763209ms -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 30595 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_63cd782359bd4caba1cd9670\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"echo 'hello bash' > test.txt\\\",\\\"description\\\":\\\"Create test.txt file with content 'hello bash'\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_63cd782359bd4caba1cd9670\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_46448734c82c4f1aac496ab3\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"cat test.txt\\\",\\\"description\\\":\\\"Verify test.txt content\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"hello bash\\n\\n\\n/tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\",\"tool_call_id\":\"call_46448734c82c4f1aac496ab3\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"20251023193932efe8634f26e2462c","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" test"}}]} + + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} + + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} + + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" '"}}]} + + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"hello"}}]} - data: {"id":"20251023193932efe8634f26e2462c","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" bash"}}]} - data: {"id":"20251023193932efe8634f26e2462c","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'."}}]} - data: {"id":"20251023193932efe8634f26e2462c","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7304,"completion_tokens":6,"total_tokens":7310,"prompt_tokens_details":{"cached_tokens":7273}}} + data: {"id":"202510240122345934d6b79e7b4efc","created":1761240154,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8193,"completion_tokens":16,"total_tokens":8209,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -162,4 +145,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 811.631959ms + duration: 713.415875ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml index 5090860416b4fd53a7669d3dae4c7aa869208609..5dfacf9253ed24dcb5503cb67c841ecac6f3ef74 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 742 + content_length: 778 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://httpbin.org/robots.txt and save it as robots.txt\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' headers: Accept: - application/json @@ -24,19 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939326760746d63e9485b","created":1761219572,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939326760746d63e9485b","created":1761219572,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Download"}}]} + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Download"}}]} - data: {"id":"202510231939326760746d63e9485b","created":1761219572,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" robots"}}]} + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"202510231939326760746d63e9485b","created":1761219572,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"202510231939326760746d63e9485b","created":1761219572,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" save"}}]} - data: {"id":"202510231939326760746d63e9485b","created":1761219572,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" httpbin"}}]} + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" as"}}]} - data: {"id":"202510231939326760746d63e9485b","created":1761219572,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":138,"completion_tokens":10,"total_tokens":148,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} + + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} + + data: {"id":"2025102401223510863719da334087","created":1761240155,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":143,"completion_tokens":11,"total_tokens":154,"prompt_tokens_details":{"cached_tokens":114}}} data: [DONE] @@ -45,15 +49,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 682.744584ms + duration: 788.240417ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29882 + content_length: 34374 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,13 +73,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319393276923c405a154c83","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122357dc29a39b872492d","created":1761240155,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319393276923c405a154c83","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122357dc29a39b872492d","created":1761240155,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319393276923c405a154c83","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_0670160af2774faa83d10e07","index":0,"type":"function","function":{"name":"download","arguments":"{\"url\":\"https://httpbin.org/robots.txt\",\"file_path\":\"robots.txt\"}"}}]}}]} + data: {"id":"202510240122357dc29a39b872492d","created":1761240155,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_4bc87ab1d4174cecbd75f35c","index":0,"type":"function","function":{"name":"download","arguments":"{\"url\":\"https://example-files.online-convert.com/document/txt/example.txt\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/example.txt\"}"}}]}}]} - data: {"id":"2025102319393276923c405a154c83","created":1761219572,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7198,"completion_tokens":34,"total_tokens":7232,"prompt_tokens_details":{"cached_tokens":43}}} + data: {"id":"202510240122357dc29a39b872492d","created":1761240155,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8153,"completion_tokens":55,"total_tokens":8208,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -84,41 +88,61 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 1.096548917s + duration: 787.087917ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/robots.txt + url: https://example-files.online-convert.com/document/txt/example.txt method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 30 - body: | - User-agent: * - Disallow: /deny + content_length: -1 + uncompressed: true + body: |- + TXT test file + Purpose: Provide example of this file type + Document file type: TXT + Version: 1.0 + Remark: + + Example content: + The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. + + John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. + + Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. + + + + File created by https://www.online-convert.com + More example files: https://www.online-convert.com/file-type + Text of Example content: Wikipedia (https://en.wikipedia.org/wiki/John_Doe) + License: Attribution-ShareAlike 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) + + Feel free to use and share the file according to the license above. headers: Content-Type: - - text/plain + - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 3.78729975s + duration: 190.343583ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30316 + content_length: 34918 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://httpbin.org/robots.txt and save it as robots.txt\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_0670160af2774faa83d10e07\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://httpbin.org/robots.txt\\\",\\\"file_path\\\":\\\"robots.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 30 bytes to /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/robots.txt (Content-Type: text/plain)\",\"tool_call_id\":\"call_0670160af2774faa83d10e07\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_4bc87ab1d4174cecbd75f35c\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/document/txt/example.txt\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/example.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"call_4bc87ab1d4174cecbd75f35c\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -134,25 +158,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Download"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ed"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Download"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ed"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" successfully"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" successfully"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" robots"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} - data: {"id":"20251023193938d6f06ecc100845b8","created":1761219578,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7270,"completion_tokens":12,"total_tokens":7282,"prompt_tokens_details":{"cached_tokens":7231}}} + data: {"id":"202510240122378f3d4b710b3b4a1c","created":1761240157,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8252,"completion_tokens":11,"total_tokens":8263,"prompt_tokens_details":{"cached_tokens":8207}}} data: [DONE] @@ -161,4 +183,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 817.809584ms + duration: 768.089334ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml index d3ef3be91ead2b35bf8d92805f45f55e18aba0a1..b32a8770c0e2c72f1a5cdc946cf4be287850a9da 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 755 + content_length: 799 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://httpbin.org/html and tell me if it contains the word ''Herman''\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' headers: Accept: - application/json @@ -24,21 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401223883fdd1f1ac494e18","created":1761240158,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Check"}}]} + data: {"id":"2025102401223883fdd1f1ac494e18","created":1761240158,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Check"}}]} - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" HTTP"}}]} + data: {"id":"2025102401223883fdd1f1ac494e18","created":1761240158,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" HTML"}}]} - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"bin"}}]} + data: {"id":"2025102401223883fdd1f1ac494e18","created":1761240158,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" HTML"}}]} + data: {"id":"2025102401223883fdd1f1ac494e18","created":1761240158,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" John"}}]} - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} + data: {"id":"2025102401223883fdd1f1ac494e18","created":1761240158,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"}}]} - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Herman"}}]} - - data: {"id":"2025102319394066ba228bfd9c43af","created":1761219580,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":141,"completion_tokens":10,"total_tokens":151,"prompt_tokens_details":{"cached_tokens":22}}} + data: {"id":"2025102401223883fdd1f1ac494e18","created":1761240158,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":148,"completion_tokens":9,"total_tokens":157,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -47,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 578.547166ms + duration: 615.636ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29892 + content_length: 34392 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -71,13 +69,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193940822dbb0cd40c4936","created":1761219580,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122382c9aaab0125647e7","created":1761240158,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193940822dbb0cd40c4936","created":1761219580,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122382c9aaab0125647e7","created":1761240158,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193940822dbb0cd40c4936","created":1761219580,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_16ca3b8b5a2d446fae811971","index":0,"type":"function","function":{"name":"fetch","arguments":"{\"format\":\"text\",\"url\":\"https://httpbin.org/html\"}"}}]}}]} + data: {"id":"202510240122382c9aaab0125647e7","created":1761240158,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_826ead313d8e4174bb520787","index":0,"type":"function","function":{"name":"fetch","arguments":"{\"format\":\"text\",\"url\":\"https://example-files.online-convert.com/website/html/example.html\"}"}}]}}]} - data: {"id":"20251023193940822dbb0cd40c4936","created":1761219580,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7203,"completion_tokens":30,"total_tokens":7233,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"202510240122382c9aaab0125647e7","created":1761240158,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8160,"completion_tokens":37,"total_tokens":8197,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -86,53 +84,86 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 708.180708ms + duration: 800.274708ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 content_length: 0 - host: httpbin.org + host: example-files.online-convert.com headers: User-Agent: - crush/1.0 - url: https://httpbin.org/html + url: https://example-files.online-convert.com/website/html/example.html method: GET response: proto: HTTP/2.0 proto_major: 2 proto_minor: 0 - content_length: 3741 + content_length: -1 + uncompressed: true body: |- + - - - -

Herman Melville - Moby-Dick

- -
-

- Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency. -

-
- + + +

HTML test file

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ + headers: Content-Type: - - text/html; charset=utf-8 + - text/html; charset=UTF-8 status: 200 OK code: 200 - duration: 2.573361416s + duration: 48.04775ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 33775 + content_length: 37226 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://httpbin.org/html and tell me if it contains the word 'Herman'\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_16ca3b8b5a2d446fae811971\",\"function\":{\"arguments\":\"{\\\"format\\\":\\\"text\\\",\\\"url\\\":\\\"https://httpbin.org/html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Herman Melville - Moby-Dick Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency.\",\"tool_call_id\":\"call_16ca3b8b5a2d446fae811971\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_826ead313d8e4174bb520787\",\"function\":{\"arguments\":\"{\\\"format\\\":\\\"text\\\",\\\"url\\\":\\\"https://example-files.online-convert.com/website/html/example.html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"tool_call_id\":\"call_826ead313d8e4174bb520787\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -148,63 +179,39 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Yes"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" word"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"H"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"erman"}}]} - - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" at"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Yes"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" beginning"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"H"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"erman"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Mel"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" word"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ville"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" '"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" -"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"John"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" M"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"oby"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-D"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" multiple"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ick"}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" times"}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"2025102319394456213ca62c454e12","created":1761219584,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8073,"completion_tokens":31,"total_tokens":8104,"prompt_tokens_details":{"cached_tokens":7232}}} + data: {"id":"20251024012240608e42b471554ef3","created":1761240160,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8754,"completion_tokens":19,"total_tokens":8773,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -213,4 +220,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 8.476835208s + duration: 854.024125ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml index 7a0b57e4867f593c60e34b34981b32d96aa9a0df..6bb3931671894cf71d18746410972e6477136240 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml @@ -24,19 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319395305add6eb6e7d4d37","created":1761219593,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012241cf81924e04234715","created":1761240161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319395305add6eb6e7d4d37","created":1761219593,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"find"}}]} + data: {"id":"20251024012241cf81924e04234715","created":1761240161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Find"}}]} - data: {"id":"2025102319395305add6eb6e7d4d37","created":1761219593,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" go"}}]} + data: {"id":"20251024012241cf81924e04234715","created":1761240161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"2025102319395305add6eb6e7d4d37","created":1761219593,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} + data: {"id":"20251024012241cf81924e04234715","created":1761240161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} - data: {"id":"2025102319395305add6eb6e7d4d37","created":1761219593,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"20251024012241cf81924e04234715","created":1761240161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"2025102319395305add6eb6e7d4d37","created":1761219593,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} + data: {"id":"20251024012241cf81924e04234715","created":1761240161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} - data: {"id":"2025102319395305add6eb6e7d4d37","created":1761219593,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":132,"completion_tokens":9,"total_tokens":141,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"20251024012241cf81924e04234715","created":1761240161,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":132,"completion_tokens":9,"total_tokens":141,"prompt_tokens_details":{"cached_tokens":114}}} data: [DONE] @@ -45,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 689.137625ms + duration: 1.163742791s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29854 + content_length: 34310 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,13 +69,127 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193953729abd38d9f7498a","created":1761219593,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193953729abd38d9f7498a","created":1761219593,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - data: {"id":"20251023193953729abd38d9f7498a","created":1761219593,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_a4ca844f3d7441db8b91fe34","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"*.go\"}"}}]}}]} + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - data: {"id":"20251023193953729abd38d9f7498a","created":1761219593,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7193,"completion_tokens":18,"total_tokens":7211,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" glob"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" find"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" all"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ."}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" This"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" straightforward"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" request"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" glob"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" pattern"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \"*."}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\""}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" find"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"which"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" default"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" path"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" if"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" not"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" specified"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":")."}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_742b9e11fa0d453b887dffe9","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"*.go\"}"}}]}}]} + + data: {"id":"20251024012241843317be654947c0","created":1761240161,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8143,"completion_tokens":75,"total_tokens":8218,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -84,15 +198,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 816.069958ms + duration: 806.708042ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30163 + content_length: 34619 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_a4ca844f3d7441db8b91fe34\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool/main.go\",\"tool_call_id\":\"call_a4ca844f3d7441db8b91fe34\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_742b9e11fa0d453b887dffe9\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool/main.go\",\"tool_call_id\":\"call_742b9e11fa0d453b887dffe9\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -108,49 +222,49 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/tmp"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/tmp"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/c"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/c"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"rush"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"rush"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-test"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-test"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/z"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/z"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ai"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ai"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-g"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-g"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lm"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lm"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"4"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"4"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/g"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/g"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lob"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lob"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"_tool"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"_tool"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/main"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/main"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"202510231939542e44424fc3484c1f","created":1761219594,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7236,"completion_tokens":24,"total_tokens":7260,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"2025102401224309bbc00f8f194730","created":1761240163,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8186,"completion_tokens":24,"total_tokens":8210,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -159,4 +273,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 1.003507291s + duration: 899.399208ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml index dcacd8830456a770d82d730434cf5f8432eb534d..e460ebabbbdbe7df661fdecb97c0696621049364 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml @@ -24,19 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193956ce4c3c79c7f3486a","created":1761219596,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122450b90ffd43d574d3b","created":1761240165,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193956ce4c3c79c7f3486a","created":1761219596,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"grep"}}]} + data: {"id":"202510240122450b90ffd43d574d3b","created":1761240165,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"grep"}}]} - data: {"id":"20251023193956ce4c3c79c7f3486a","created":1761219596,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" package"}}]} + data: {"id":"202510240122450b90ffd43d574d3b","created":1761240165,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" package"}}]} - data: {"id":"20251023193956ce4c3c79c7f3486a","created":1761219596,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} + data: {"id":"202510240122450b90ffd43d574d3b","created":1761240165,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} - data: {"id":"20251023193956ce4c3c79c7f3486a","created":1761219596,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" go"}}]} + data: {"id":"202510240122450b90ffd43d574d3b","created":1761240165,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" go"}}]} - data: {"id":"20251023193956ce4c3c79c7f3486a","created":1761219596,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} + data: {"id":"202510240122450b90ffd43d574d3b","created":1761240165,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} - data: {"id":"20251023193956ce4c3c79c7f3486a","created":1761219596,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":9,"total_tokens":142,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"202510240122450b90ffd43d574d3b","created":1761240165,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":9,"total_tokens":142,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -45,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 723.143ms + duration: 582.762958ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29852 + content_length: 34308 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,13 +69,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193956abaef9a883d54f0c","created":1761219596,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012245f274061ae7674bfa","created":1761240165,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251023193956abaef9a883d54f0c","created":1761219596,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012245f274061ae7674bfa","created":1761240165,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193956abaef9a883d54f0c","created":1761219596,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_e5a955b077a04e7ea293bbfd","index":0,"type":"function","function":{"name":"grep","arguments":"{\"include\":\"*.go\",\"pattern\":\"package\"}"}}]}}]} + data: {"id":"20251024012245f274061ae7674bfa","created":1761240165,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_f0bb110d561e4ddd86818221","index":0,"type":"function","function":{"name":"grep","arguments":"{\"include\":\"*.go\",\"literal_text\":true,\"pattern\":\"package\"}"}}]}}]} - data: {"id":"20251023193956abaef9a883d54f0c","created":1761219596,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7194,"completion_tokens":26,"total_tokens":7220,"prompt_tokens_details":{"cached_tokens":7148}}} + data: {"id":"20251024012245f274061ae7674bfa","created":1761240165,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8144,"completion_tokens":35,"total_tokens":8179,"prompt_tokens_details":{"cached_tokens":43}}} data: [DONE] @@ -84,15 +84,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 722.186958ms + duration: 968.603334ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30237 + content_length: 34713 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_e5a955b077a04e7ea293bbfd\",\"function\":{\"arguments\":\"{\\\"include\\\":\\\"*.go\\\",\\\"pattern\\\":\\\"package\\\"}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_e5a955b077a04e7ea293bbfd\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_f0bb110d561e4ddd86818221\",\"function\":{\"arguments\":\"{\\\"include\\\":\\\"*.go\\\",\\\"literal_text\\\":true,\\\"pattern\\\":\\\"package\\\"}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_f0bb110d561e4ddd86818221\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -108,43 +108,39 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" match"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" match"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" at"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" line"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" -"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"package"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"package"}}]} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} - - data: {"id":"20251023193957786069b8743b4d27","created":1761219597,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7262,"completion_tokens":21,"total_tokens":7283,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"202510240122467d39ef1171b7486f","created":1761240166,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8221,"completion_tokens":19,"total_tokens":8240,"prompt_tokens_details":{"cached_tokens":8098}}} data: [DONE] @@ -153,4 +149,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 936.940583ms + duration: 5.199448208s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml index 067f0aa5fcece6a79e22e2233d41ae4a78f7aea3..15ea4c1251dc59698f481665b03aa776601d63b1 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29846 + content_length: 712 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse ls to list the files in the current directory\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' headers: Accept: - application/json @@ -24,13 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194000a4c6b1d7606442f5","created":1761219600,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122524b46da2244604d8f","created":1761240172,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"202510240122524b46da2244604d8f","created":1761240172,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"List"}}]} + + data: {"id":"202510240122524b46da2244604d8f","created":1761240172,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} + + data: {"id":"202510240122524b46da2244604d8f","created":1761240172,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251023194000a4c6b1d7606442f5","created":1761219600,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122524b46da2244604d8f","created":1761240172,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} - data: {"id":"20251023194000a4c6b1d7606442f5","created":1761219600,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_5630f3342cc8434dbf157680","index":0,"type":"function","function":{"name":"ls","arguments":"{\"path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\"}"}}]}}]} + data: {"id":"202510240122524b46da2244604d8f","created":1761240172,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" command"}}]} - data: {"id":"20251023194000a4c6b1d7606442f5","created":1761219600,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7191,"completion_tokens":33,"total_tokens":7224,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"202510240122524b46da2244604d8f","created":1761240172,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":130,"completion_tokens":9,"total_tokens":139,"prompt_tokens_details":{"cached_tokens":22}}} data: [DONE] @@ -39,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 874.697958ms + duration: 845.033917ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 712 + content_length: 34302 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse ls to list the files in the current directory\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -63,17 +69,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194000e19061071b174e5e","created":1761219600,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251023194000e19061071b174e5e","created":1761219600,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"List"}}]} - - data: {"id":"20251023194000e19061071b174e5e","created":1761219600,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} + data: {"id":"20251024012252c2ff6e2a768e4d0c","created":1761240172,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194000e19061071b174e5e","created":1761219600,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"20251024012252c2ff6e2a768e4d0c","created":1761240172,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194000e19061071b174e5e","created":1761219600,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} + data: {"id":"20251024012252c2ff6e2a768e4d0c","created":1761240172,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_ac574ea3bf75493681e5cf1d","index":0,"type":"function","function":{"name":"ls","arguments":"{\"path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\"}"}}]}}]} - data: {"id":"20251023194000e19061071b174e5e","created":1761219600,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":130,"completion_tokens":8,"total_tokens":138,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"20251024012252c2ff6e2a768e4d0c","created":1761240172,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8141,"completion_tokens":33,"total_tokens":8174,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -82,15 +84,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 12.330620459s + duration: 6.918412291s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30217 + content_length: 34673 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_5630f3342cc8434dbf157680\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_5630f3342cc8434dbf157680\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_ac574ea3bf75493681e5cf1d\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_ac574ea3bf75493681e5cf1d\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -106,21 +108,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251023194013a67ebee7a4e14371","created":1761219613,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7259,"completion_tokens":10,"total_tokens":7269,"prompt_tokens_details":{"cached_tokens":7223}}} + data: {"id":"20251024012259465ace8dd6864712","created":1761240179,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8209,"completion_tokens":10,"total_tokens":8219,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -129,4 +131,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 758.529791ms + duration: 2.905540875s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml index b5efb885c27b0941d396ad53afd55214d85ecb48..6ca8870c1b5ac048c6a299c5f617ed4dc81b15c9 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml @@ -24,25 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Mult"}}]} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Mult"}}]} - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"ied"}}]} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"ied"}}]} - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"it"}}]} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"it"}}]} - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" File"}}]} - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" changes"}}]} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Modification"}}]} - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" comment"}}]} - - data: {"id":"20251023194014e0f785fdff054e61","created":1761219614,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":153,"completion_tokens":12,"total_tokens":165,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"202510240123034c884401f7c24d10","created":1761240183,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":153,"completion_tokens":10,"total_tokens":163,"prompt_tokens_details":{"cached_tokens":22}}} data: [DONE] @@ -51,15 +47,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 649.245958ms + duration: 746.32975ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29932 + content_length: 34388 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -75,67 +71,67 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"I"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"I"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'ll"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'ll"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" help"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" help"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" you"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" you"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" modify"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" use"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" mult"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ied"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"it"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" using"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" modify"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" mult"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ied"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"it"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" First"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Let"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" let"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" me"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" me"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" first"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" read"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" read"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" current"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" see"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" understand"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" its"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" its"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" current"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" structure"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".\n"}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".\n"}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_93e7be5ffe434c7a8b9007af","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\"}"}}]}}]} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_4baace2a59a949e188fa0a42","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\"}"}}]}}]} - data: {"id":"20251023194014cf9617b8e3e24168","created":1761219614,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7216,"completion_tokens":65,"total_tokens":7281,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"202510240123034a0d2f5cb4654108","created":1761240183,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8166,"completion_tokens":65,"total_tokens":8231,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -144,15 +140,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.278757792s + duration: 1.038418583s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30517 + content_length: 34964 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\n\\nI'll help you modify the main.go file using multiedit. First, let me read the current file to understand its structure.\\n\",\"tool_calls\":[{\"id\":\"call_93e7be5ffe434c7a8b9007af\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_93e7be5ffe434c7a8b9007af\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\n\\nI'll help you use multiedit to modify the main.go file. Let me first read the file to see its current content.\\n\",\"tool_calls\":[{\"id\":\"call_4baace2a59a949e188fa0a42\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_4baace2a59a949e188fa0a42\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -168,13 +164,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231940202a4002083a324953","created":1761219620,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240123055e1f0c9b1f24483d","created":1761240186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231940202a4002083a324953","created":1761219620,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240123055e1f0c9b1f24483d","created":1761240186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231940202a4002083a324953","created":1761219620,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_4175efce836241498b37ee1c","index":0,"type":"function","function":{"name":"multiedit","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\",\"edits\":[{\"old_string\": \"\\tfmt.Println(\\\"Hello, World!\\\")\", \"new_string\": \"\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\"}, {\"old_string\": \"\\\"Hello, World!\\\"\", \"new_string\": \"\\\"Hello, Crush!\\\"\"}]}"}}]}}]} + data: {"id":"202510240123055e1f0c9b1f24483d","created":1761240186,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_39bdc8dda9084d348f2998d1","index":0,"type":"function","function":{"name":"multiedit","arguments":"{\"edits\":[{\"new_string\": \"\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\", \"old_string\": \"\\tfmt.Println(\\\"Hello, World!\\\")\"}],\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\"}"}}]}}]} - data: {"id":"202510231940202a4002083a324953","created":1761219620,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7338,"completion_tokens":106,"total_tokens":7444,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"202510240123055e1f0c9b1f24483d","created":1761240186,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8288,"completion_tokens":85,"total_tokens":8373,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -183,54 +179,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 742.6975ms + duration: 808.772416ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31184 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\n\\nI'll help you modify the main.go file using multiedit. First, let me read the current file to understand its structure.\\n\",\"tool_calls\":[{\"id\":\"call_93e7be5ffe434c7a8b9007af\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_93e7be5ffe434c7a8b9007af\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_4175efce836241498b37ee1c\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\", \\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}, {\\\"old_string\\\": \\\"\\\\\\\"Hello, World!\\\\\\\"\\\", \\\"new_string\\\": \\\"\\\\\\\"Hello, Crush!\\\\\\\"\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"edit 2 failed: old_string not found in content. Make sure it matches exactly, including whitespace and line breaks\",\"tool_call_id\":\"call_4175efce836241498b37ee1c\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"20251023194025ebc9ed914d0f4e93","created":1761219626,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251023194025ebc9ed914d0f4e93","created":1761219626,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251023194025ebc9ed914d0f4e93","created":1761219626,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_6be72be1769644b09c442d0c","index":0,"type":"function","function":{"name":"multiedit","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\",\"edits\":[{\"old_string\": \"\\tfmt.Println(\\\"Hello, World!\\\")\", \"new_string\": \"\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\"}]}"}}]}}]} - - data: {"id":"20251023194025ebc9ed914d0f4e93","created":1761219626,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7473,"completion_tokens":85,"total_tokens":7558,"prompt_tokens_details":{"cached_tokens":45}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 1.090667916s -- id: 4 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 31759 + content_length: 35541 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\n\\nI'll help you modify the main.go file using multiedit. First, let me read the current file to understand its structure.\\n\",\"tool_calls\":[{\"id\":\"call_93e7be5ffe434c7a8b9007af\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_93e7be5ffe434c7a8b9007af\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_4175efce836241498b37ee1c\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\", \\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}, {\\\"old_string\\\": \\\"\\\\\\\"Hello, World!\\\\\\\"\\\", \\\"new_string\\\": \\\"\\\\\\\"Hello, Crush!\\\\\\\"\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"edit 2 failed: old_string not found in content. Make sure it matches exactly, including whitespace and line breaks\",\"tool_call_id\":\"call_4175efce836241498b37ee1c\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_6be72be1769644b09c442d0c\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\", \\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_6be72be1769644b09c442d0c\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\n\\nI'll help you use multiedit to modify the main.go file. Let me first read the file to see its current content.\\n\",\"tool_calls\":[{\"id\":\"call_4baace2a59a949e188fa0a42\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_4baace2a59a949e188fa0a42\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_39bdc8dda9084d348f2998d1\",\"function\":{\"arguments\":\"{\\\"edits\\\":[{\\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\", \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"}],\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_39bdc8dda9084d348f2998d1\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -246,73 +203,73 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" The"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Changed"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file now"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" has"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" comment"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" World"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \"//"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" G"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"reeting"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" above"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".Println"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" line"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" added"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" comment"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" above"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" World"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".Println"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" has"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" line"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" been"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" changed"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"5"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\"."}}]} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"202510231940443a98ca46ce6940a7","created":1761219644,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7599,"completion_tokens":37,"total_tokens":7636,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"20251024012308047cc796a2ac4dc6","created":1761240188,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8414,"completion_tokens":36,"total_tokens":8450,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -321,4 +278,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 13.723606209s + duration: 1.125376958s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml index 34c5eb5af9ece6514d3cf4f0dccdd4b1414f58b6..b6e67550523ad7b6a8ee9b92e8db6eb0ea557f4e 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml @@ -24,19 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194135c14587f136ec4360","created":1761219695,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012527da72030046ab4ad7","created":1761240327,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194135c14587f136ec4360","created":1761219695,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Parallel"}}]} + data: {"id":"20251024012527da72030046ab4ad7","created":1761240327,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Parallel"}}]} - data: {"id":"20251023194135c14587f136ec4360","created":1761219695,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} + data: {"id":"20251024012527da72030046ab4ad7","created":1761240327,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} - data: {"id":"20251023194135c14587f136ec4360","created":1761219695,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} + data: {"id":"20251024012527da72030046ab4ad7","created":1761240327,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"20251023194135c14587f136ec4360","created":1761219695,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} + data: {"id":"20251024012527da72030046ab4ad7","created":1761240327,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} - data: {"id":"20251023194135c14587f136ec4360","created":1761219695,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" commands"}}]} + data: {"id":"20251024012527da72030046ab4ad7","created":1761240327,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" commands"}}]} - data: {"id":"20251023194135c14587f136ec4360","created":1761219695,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":149,"completion_tokens":9,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"20251024012527da72030046ab4ad7","created":1761240327,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":149,"completion_tokens":9,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":115}}} data: [DONE] @@ -45,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 665.002375ms + duration: 634.643125ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29943 + content_length: 34399 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,15 +69,15 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319413581a54d1615454370","created":1761219695,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240125272e4a3a2fa06e4cda","created":1761240327,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319413581a54d1615454370","created":1761219695,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240125272e4a3a2fa06e4cda","created":1761240327,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319413581a54d1615454370","created":1761219695,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_05b56023109b45cc983215da","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/*.go\"}"}}]}}]} + data: {"id":"202510240125272e4a3a2fa06e4cda","created":1761240327,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_ed19b8476adb4fc392f34a1f","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/*.go\"}"}}]}}]} - data: {"id":"2025102319413581a54d1615454370","created":1761219695,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_9313ff283f8a428e9b44f3a2","index":1,"type":"function","function":{"name":"ls","arguments":"{\"path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\"}"}}]}}]} + data: {"id":"202510240125272e4a3a2fa06e4cda","created":1761240327,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_fa78489b010742d2967565ce","index":1,"type":"function","function":{"name":"ls","arguments":"{}"}}]}}]} - data: {"id":"2025102319413581a54d1615454370","created":1761219695,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7211,"completion_tokens":49,"total_tokens":7260,"prompt_tokens_details":{"cached_tokens":43}}} + data: {"id":"202510240125272e4a3a2fa06e4cda","created":1761240327,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8161,"completion_tokens":24,"total_tokens":8185,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -86,15 +86,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 880.381792ms + duration: 643.706875ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30607 + content_length: 34989 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_05b56023109b45cc983215da\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_9313ff283f8a428e9b44f3a2\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_05b56023109b45cc983215da\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_9313ff283f8a428e9b44f3a2\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_ed19b8476adb4fc392f34a1f\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_fa78489b010742d2967565ce\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_ed19b8476adb4fc392f34a1f\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_fa78489b010742d2967565ce\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -110,47 +110,53 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" ."}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"main"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`."}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Directory"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Directory"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" go"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"20251023194137e9f3bd13ab2e4548","created":1761219697,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7321,"completion_tokens":23,"total_tokens":7344,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"main"}}]} + + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`."}}]} + + data: {"id":"202510240125286a133ca59f554356","created":1761240328,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8246,"completion_tokens":26,"total_tokens":8272,"prompt_tokens_details":{"cached_tokens":8184}}} data: [DONE] @@ -159,4 +165,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 898.956708ms + duration: 2.375977541s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml index ec1d3a9c4b3c5b0b918172f3491889b6b84cbb93..566d0d88bcf5bdbb4b6b1386b01a6cfe493f51ff 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml @@ -24,17 +24,17 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193849468143b4e0e84c88","created":1761219529,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012139b6e2cdff09464a91","created":1761240099,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193849468143b4e0e84c88","created":1761219529,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Generate"}}]} + data: {"id":"20251024012139b6e2cdff09464a91","created":1761240099,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Read"}}]} - data: {"id":"20251023193849468143b4e0e84c88","created":1761219529,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" go"}}]} + data: {"id":"20251024012139b6e2cdff09464a91","created":1761240099,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"20251023193849468143b4e0e84c88","created":1761219529,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" mod"}}]} + data: {"id":"20251024012139b6e2cdff09464a91","created":1761240099,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" go"}}]} - data: {"id":"20251023193849468143b4e0e84c88","created":1761219529,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" title"}}]} + data: {"id":"20251024012139b6e2cdff09464a91","created":1761240099,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" mod"}}]} - data: {"id":"20251023193849468143b4e0e84c88","created":1761219529,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":124,"completion_tokens":8,"total_tokens":132,"prompt_tokens_details":{"cached_tokens":114}}} + data: {"id":"20251024012139b6e2cdff09464a91","created":1761240099,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":124,"completion_tokens":8,"total_tokens":132,"prompt_tokens_details":{"cached_tokens":114}}} data: [DONE] @@ -43,15 +43,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 675.93825ms + duration: 924.615667ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29816 + content_length: 34272 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -67,13 +67,191 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193850a66e7e65ad084aae","created":1761219530,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193850a66e7e65ad084aae","created":1761219530,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - data: {"id":"20251023193850a66e7e65ad084aae","created":1761219530,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_8e2adf52ab894938a080e4a6","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\"}"}}]}}]} + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - data: {"id":"20251023193850a66e7e65ad084aae","created":1761219530,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7185,"completion_tokens":36,"total_tokens":7221,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" read"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" go"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".mod"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" view"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" read"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" go"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".mod"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Since"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" they"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" didn"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'t"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" specify"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" path"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" look"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" working"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" first"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" working"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" /"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"tmp"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/c"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"rush"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-test"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/Test"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Coder"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Agent"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/z"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"ai"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-g"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"lm"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"4"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"6"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/read"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"_a"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"_file"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Let"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" first"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" check"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" what"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" are"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" this"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" see"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" if"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" there"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'s"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" go"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".mod"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" then"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" read"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" it"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_1618edb7d1df4d079b56edbc","index":0,"type":"function","function":{"name":"ls","arguments":"{\"path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\"}"}}]}}]} + + data: {"id":"202510240121425802fe0e1e9f466e","created":1761240102,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8135,"completion_tokens":122,"total_tokens":8257,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -82,15 +260,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 800.212416ms + duration: 3.497814959s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30205 + content_length: 34651 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_8e2adf52ab894938a080e4a6\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_8e2adf52ab894938a080e4a6\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_1618edb7d1df4d079b56edbc\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_1618edb7d1df4d079b56edbc\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -106,13 +284,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193851ef879bbef3e2404b","created":1761219531,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251024012147e3ced86c5d494fa2","created":1761240107,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193851ef879bbef3e2404b","created":1761219531,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012147e3ced86c5d494fa2","created":1761240107,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193851ef879bbef3e2404b","created":1761219531,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_18ac317c12ad4cd2ae97ffa7","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\"}"}}]}}]} + data: {"id":"20251024012147e3ced86c5d494fa2","created":1761240107,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_505d0a6edd8847cdbc5c2f30","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\"}"}}]}}]} - data: {"id":"20251023193851ef879bbef3e2404b","created":1761219531,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7256,"completion_tokens":36,"total_tokens":7292,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"20251024012147e3ced86c5d494fa2","created":1761240107,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8203,"completion_tokens":36,"total_tokens":8239,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -121,15 +299,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 11.365943916s + duration: 3.013069083s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30592 + content_length: 35040 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_8e2adf52ab894938a080e4a6\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_8e2adf52ab894938a080e4a6\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_18ac317c12ad4cd2ae97ffa7\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_18ac317c12ad4cd2ae97ffa7\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_1618edb7d1df4d079b56edbc\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_1618edb7d1df4d079b56edbc\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_505d0a6edd8847cdbc5c2f30\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_505d0a6edd8847cdbc5c2f30\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -145,41 +323,33 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"``"}}]} - - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`\n"}}]} - - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"module"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".com"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"module"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/test"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"project"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".com"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/test"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"project"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"23"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"```"}}]} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"23"}}]} - data: {"id":"202510231939035dffe876195f44e4","created":1761219543,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7327,"completion_tokens":20,"total_tokens":7347,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"20251024012151fdc8ea04b2d64797","created":1761240111,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8274,"completion_tokens":16,"total_tokens":8290,"prompt_tokens_details":{"cached_tokens":8238}}} data: [DONE] @@ -188,4 +358,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 941.345625ms + duration: 3.0204245s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml index 6048e7369ed92d227d3d39315e8686d809e2448d..1af5add3a8bc9b2c25d47dfe3fcb570f320b61eb 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml @@ -24,13 +24,11 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231938484421ad8fc46b4cb0","created":1761219528,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012136fd62b604d7734117","created":1761240096,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231938484421ad8fc46b4cb0","created":1761219528,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"G"}}]} + data: {"id":"20251024012136fd62b604d7734117","created":1761240096,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"202510231938484421ad8fc46b4cb0","created":1761219528,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"reeting"}}]} - - data: {"id":"202510231938484421ad8fc46b4cb0","created":1761219528,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":121,"completion_tokens":6,"total_tokens":127,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"20251024012136fd62b604d7734117","created":1761240096,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":121,"completion_tokens":5,"total_tokens":126,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -39,15 +37,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.322141542s + duration: 2.257451833s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29806 + content_length: 34262 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -63,29 +61,167 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" just"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" said"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Hello"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"."}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" This"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" simple"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" greeting"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" According"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" my"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" instructions"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" keep"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" responses"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" minimal"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" -"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" under"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":" "}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"4"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" lines"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" no"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" preamble"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" one"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-word"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" answers"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" when"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" possible"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Since"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" this"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" just"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" greeting"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" respond"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" simple"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Hello"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\""}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" back"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"I"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" don"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'t"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" any"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tools"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" this"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" response"}}]} + + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" How"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" How"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" can"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" can"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" I"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" I"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" help"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" help"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" you"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" you"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" today"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" today"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"?"}}]} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"?"}}]} - data: {"id":"2025102319384815286d0277ca4f79","created":1761219528,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7181,"completion_tokens":14,"total_tokens":7195,"prompt_tokens_details":{"cached_tokens":43}}} + data: {"id":"20251024012136e19dd8a5fa344878","created":1761240096,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8131,"completion_tokens":83,"total_tokens":8214,"prompt_tokens_details":{"cached_tokens":43}}} data: [DONE] @@ -94,4 +230,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.755374083s + duration: 2.755136958s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml index 3ccf54af9318560cdf0ca4a50783bb6e10811ece..f255981b922e54f2683546f074dd7a562ad65cfc 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml @@ -24,21 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Searching"}}]} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Search"}}]} - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" func"}}]} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" repos"}}]} - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Source"}}]} - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" repos"}}]} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"graph"}}]} - data: {"id":"20251023194059e016e8f5a39b4ef7","created":1761219659,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":10,"total_tokens":143,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"20251024012454f0f843bd6f4f495f","created":1761240295,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":10,"total_tokens":143,"prompt_tokens_details":{"cached_tokens":115}}} data: [DONE] @@ -47,15 +47,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 793.145875ms + duration: 2.291818542s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29866 + content_length: 34322 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -71,241 +71,353 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Source"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Source"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" repositories"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" repositories"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" This"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" source"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" straightforward"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" that"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"1"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" source"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Searches"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" function"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" literal"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" text"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" parameter"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Since"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'\n"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" they"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"2"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" specifically"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" want"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Filters"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" repositories"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" only"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" repositories"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/files"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" include"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Looking"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" language"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" at"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" filter"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" source"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" description"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Looking"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" can"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" at"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" source"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" lang"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" parameters"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" filter"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" limit"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"required"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" code"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"):"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" The"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" since"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" count"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"optional"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"):"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" specific"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Number"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" pattern"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" of"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" results"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"default"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":" "}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" exact"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"10"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" matching"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" max"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" quotes"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":" "}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"20"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":")\n"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" context"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" be"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"_window"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" something"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" like"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"optional"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"):"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Context"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" around"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" matches"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" lang"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"default"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":" "}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"10"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" lines"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Let"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":")\n"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" make"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" timeout"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" this"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"optional"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"):"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Timeout"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_b31d321bdb3147f3ba95bf64","index":0,"type":"function","function":{"name":"sourcegraph","arguments":"{\"query\":\"\\\"func main\\\" lang:go\",\"count\":20}"}}]}}]} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} - data: {"id":"20251023194059abba966c3ed345d5","created":1761219659,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7194,"completion_tokens":146,"total_tokens":7340,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" seconds"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"max"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":" "}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"120"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":")\n\n"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" be"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" term"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Since"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" they"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" want"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" repositories"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" add"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" lang"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" filter"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" code"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"So"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" full"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" would"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" be"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" lang"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_450ec495f0094550a425f931","index":0,"type":"function","function":{"name":"sourcegraph","arguments":"{\"query\":\"func main lang:go\"}"}}]}}]} + + data: {"id":"202510240124557826cdac49f0459b","created":1761240295,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8144,"completion_tokens":192,"total_tokens":8336,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -314,15 +426,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 849.308875ms + duration: 20.982853375s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 428 + content_length: 424 host: sourcegraph.com - body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"\"func main\" lang:go"}}' + body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"func main lang:go"}}' headers: Content-Type: - application/json @@ -336,21 +448,21 @@ interactions: proto_minor: 0 content_length: -1 uncompressed: true - body: '{"data":{"search":{"results":{"matchCount":30,"limitHit":true,"resultCount":30,"approximateResultCount":"30+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/inancgumus/learngo"},"file":{"path":"translation/chinese/02-编写第一个程序/main.go","url":"/github.com/inancgumus/learngo/-/blob/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main 是一个特殊的包\n// 它允许 Go 创建一个可执行文件\npackage main\n\n/*\n这是一个多行注释\n\nimport 关键字引入另一个包\n 对于这个 .go ”文件“\n\nimport \"fmt\" 允许你使用 fmt 包的各种函数\n 在这个文件\n*/\nimport \"fmt\"\n\n// \"func main\" 是特殊的\n//\n// Go 必须知道从哪里开始执行\n//\n// func main 对于 Go 而言就是开始执行的位置\n//\n// 代码编译后,\n// Go runtime 第一个执行该函数\nfunc main() {\n\t// import \"fmt\" 之后\n\t// \"fmt\" 包中的 Println 函数就可以使用\n\n\t// 在控制台输入下面的命令可以查看它的源代码:\n\t// go doc -src fmt Println\n\n\t// Println 是一个 exported 函数来自\n\t// \"fmt\" 包\n\n\t// Exported = 首字母大写\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go 本身不能调用 Println 函数\n\t// 这就是为什么你需要在这里调用它\n\t// Go 只能自动地调用 `func main`\n\n\t// -----\n\n\t// Go 字符串支持 Unicode 字符\n\t// 源代码同时也支持: KÖSTEBEK!\n\t//\n\t// 因为: 字面值 ~= 源代码\n\n\t// 练习: 删除下行注释的 --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// 不重要的注释:\n\t// \"Merhaba Köstebek\" 的意思是 \"你好 Gopher\"\n\t// 在土耳其语\n}\n"},"lineMatches":[{"preview":"// \"func main\" 是特殊的","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"\t// Go 只能自动地调用 `func main`","lineNumber":46,"offsetAndLengths":[[16,9]]},{"preview":"// func main 对于 Go 而言就是开始执行的位置","lineNumber":27,"offsetAndLengths":[[3,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/inancgumus/learngo"},"file":{"path":"first/first/main.go","url":"/github.com/inancgumus/learngo/-/blob/first/first/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// go doc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main creates a starting point for Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// It only calls `func main` automatically.","lineNumber":46,"offsetAndLengths":[[19,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/Go-Learning-Land/Go-Learning-Archive"},"file":{"path":"GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go","url":"/github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go","content":"// Copyright © 2021 Inanc Gumus\n// Learn Go Programming Course\n// Licencia: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// Para mas tutoriales: https://learngoprogramming.com\n// Clases particulares: https://www.linkedin.com/in/inancgumus/\n// Sigueme en twitter: https://twitter.com/inancgumus\n\n// package main es un paquete especial\n// le permite a Go crear un archivo ejecutable\npackage main\n\n/*\nEsto es un comentario multilinea.\n\nla palabra import hace que otro paquete este disponible\n para este \"archivo\" .go.\n\nimport \"fmt\" te permite acceder a la funcionaliddad del paquete fmt\n en este archivo.\n*/\nimport \"fmt\"\n\n// \"func main\" es especial.\n//\n// Go tiene que saber por donde empezar\n//\n// func main crea un punto de inicio para Go\n//\n// Despues de compilar el codigo,\n// Go ejecutara esta funcion primero.\nfunc main() {\n\t// despues del: import \"fmt\"\n\t// La funcion Println del paquete \"fmt\" estara disponible\n\n\t// Lee sobre ella escribiendo los siguiente en la consola:\n\t// go doc -src fmt Println\n\n\t// Println es simplemente una funcion exportada de:\n\t// \"fmt\" package\n\n\t// Exportada = Primera letra en mayuscula\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go no puede llamar a la funcion Println por si mismo.\n\t// Por eso la tienes que llamar aqui.\n\t// Solo llama a la `func main` de forma automatica.\n\n\t// -----\n\n\t// Go soporta caracteres unicode en cadenas de texto literal\n\t// y tambien en el codigo fuente: KÖSTEBEK!\n\t//\n\t// Porque: Literal ~= Codigo Fuente\n}\n"},"lineMatches":[{"preview":"// \"func main\" es especial.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main crea un punto de inicio para Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// Solo llama a la `func main` de forma automatica.","lineNumber":46,"offsetAndLengths":[[21,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/inancgumus/learngo"},"file":{"path":"translation/spanish/02-tu-primer-programa/main.go","url":"/github.com/inancgumus/learngo/-/blob/translation/spanish/02-tu-primer-programa/main.go","content":"// Copyright © 2021 Inanc Gumus\n// Learn Go Programming Course\n// Licencia: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// Para mas tutoriales: https://learngoprogramming.com\n// Clases particulares: https://www.linkedin.com/in/inancgumus/\n// Sigueme en twitter: https://twitter.com/inancgumus\n\n// package main es un paquete especial\n// le permite a Go crear un archivo ejecutable\npackage main\n\n/*\nEsto es un comentario multilinea.\n\nla palabra import hace que otro paquete este disponible\n para este \"archivo\" .go.\n\nimport \"fmt\" te permite acceder a la funcionaliddad del paquete fmt\n en este archivo.\n*/\nimport \"fmt\"\n\n// \"func main\" es especial.\n//\n// Go tiene que saber por donde empezar\n//\n// func main crea un punto de inicio para Go\n//\n// Después de compilar el codigo,\n// Go ejecutará esta función primero.\nfunc main() {\n\t// después del: import \"fmt\"\n\t// La función Println del paquete \"fmt\" estará disponible\n\n\t// Lee sobre ella escribiendo los siguiente en la consola:\n\t// go doc -src fmt Println\n\n\t// Println es simplemente una función exportada de:\n\t// \"fmt\" package\n\n\t// Para poder exportar una función tendrás que escribir el\n\t// primer caracter del nombre de la función en mayúscula.\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go no puede llamar a la función Println por si mismo.\n\t// Por eso la tienes que llamar aqui.\n\t// Solo llama a la `func main` de forma automatica.\n\n\t// -----\n\n\t// Go soporta caracteres unicode en cadenas de texto literal\n\t// y tambien en el codigo fuente: KÖSTEBEK!\n\t//\n\t// Porque: Literal ~= Codigo Fuente\n}\n"},"lineMatches":[{"preview":"// \"func main\" es especial.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main crea un punto de inicio para Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// Solo llama a la `func main` de forma automatica.","lineNumber":47,"offsetAndLengths":[[21,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/inancgumus/learngo"},"file":{"path":"02-write-your-first-program/main.go","url":"/github.com/inancgumus/learngo/-/blob/02-write-your-first-program/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// go doc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\t//\n\t// Because: Literal ~= Source Code\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main creates a starting point for Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// It only calls `func main` automatically.","lineNumber":46,"offsetAndLengths":[[19,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/Go-Learning-Land/Go-Learning-Archive"},"file":{"path":"GolangBasics/learngo/translation/chinese/02-编写第一个程序/main.go","url":"/github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main 是一个特殊的包\n// 它允许 Go 创建一个可执行文件\npackage main\n\n/*\n这是一个多行注释\n\nimport 关键字引入另一个包\n 对于这个 .go ”文件“\n\nimport \"fmt\" 允许你使用 fmt 包的各种函数\n 在这个文件\n*/\nimport \"fmt\"\n\n// \"func main\" 是特殊的\n//\n// Go 必须知道从哪里开始执行\n//\n// func main 对于 Go 而言就是开始执行的位置\n//\n// 代码编译后,\n// Go runtime 第一个执行该函数\nfunc main() {\n\t// import \"fmt\" 之后\n\t// \"fmt\" 包中的 Println 函数就可以使用\n\n\t// 在控制台输入下面的命令可以查看它的源代码:\n\t// go doc -src fmt Println\n\n\t// Println 是一个 exported 函数来自\n\t// \"fmt\" 包\n\n\t// Exported = 首字母大写\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go 本身不能调用 Println 函数\n\t// 这就是为什么你需要在这里调用它\n\t// Go 只能自动地调用 `func main`\n\n\t// -----\n\n\t// Go 字符串支持 Unicode 字符\n\t// 源代码同时也支持: KÖSTEBEK!\n\t//\n\t// 因为: 字面值 ~= 源代码\n\n\t// 练习: 删除下行注释的 --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// 不重要的注释:\n\t// \"Merhaba Köstebek\" 的意思是 \"你好 Gopher\"\n\t// 在土耳其语\n}\n"},"lineMatches":[{"preview":"// \"func main\" 是特殊的","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"\t// Go 只能自动地调用 `func main`","lineNumber":46,"offsetAndLengths":[[16,9]]},{"preview":"// func main 对于 Go 而言就是开始执行的位置","lineNumber":27,"offsetAndLengths":[[3,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/Go-Learning-Land/Go-Learning-Archive"},"file":{"path":"GolangBasics/learngo/first/first/main.go","url":"/github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/first/first/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// go doc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main creates a starting point for Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// It only calls `func main` automatically.","lineNumber":46,"offsetAndLengths":[[19,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/Go-Learning-Land/Go-Learning-Archive"},"file":{"path":"GolangBasics/learngo/02-write-your-first-program/main.go","url":"/github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/02-write-your-first-program/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// go doc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\t//\n\t// Because: Literal ~= Source Code\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]}]}]}}}}' + 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.5110985s + duration: 1.474336209s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 50906 + content_length: 42050 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_b31d321bdb3147f3ba95bf64\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"\\\\\\\"func main\\\\\\\" lang:go\\\",\\\"count\\\":20}\",\"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/inancgumus/learngo/translation/chinese/02-编写第一个程序/main.go\\n\\nURL: /github.com/inancgumus/learngo/-/blob/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go\\n\\n```\\n13| /*\\n14| 这是一个多行注释\\n15| \\n16| import 关键字引入另一个包\\n17| 对于这个 .go ”文件“\\n18| \\n19| import \\\"fmt\\\" 允许你使用 fmt 包的各种函数\\n20| 在这个文件\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" 是特殊的\\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| // Go runtime 第一个执行该函数\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| func main() {\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n34| \\t// \\\"fmt\\\" 包中的 Println 函数就可以使用\\n35| \\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println 是一个 exported 函数来自\\n40| \\t// \\\"fmt\\\" 包\\n41| \\n```\\n\\n```\\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println 是一个 exported 函数来自\\n40| \\t// \\\"fmt\\\" 包\\n41| \\n42| \\t// Exported = 首字母大写\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go 本身不能调用 Println 函数\\n46| \\t// Go 只能自动地调用 `func main`\\n47| \\t// Go 只能自动地调用 `func main`\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go 字符串支持 Unicode 字符\\n52| \\t// 源代码同时也支持: KÖSTEBEK!\\n53| \\t//\\n54| \\t// 因为: 字面值 ~= 源代码\\n55| \\n56| \\t// 练习: 删除下行注释的 --> //\\n```\\n\\n```\\n17| 对于这个 .go ”文件“\\n18| \\n19| import \\\"fmt\\\" 允许你使用 fmt 包的各种函数\\n20| 在这个文件\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| // func main 对于 Go 而言就是开始执行的位置\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| // Go runtime 第一个执行该函数\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n34| \\t// \\\"fmt\\\" 包中的 Println 函数就可以使用\\n35| \\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n## Result 2: github.com/inancgumus/learngo/first/first/main.go\\n\\nURL: /github.com/inancgumus/learngo/-/blob/first/first/main.go\\n\\n```\\n13| /*\\n14| This is a multi-line comment.\\n15| \\n16| import keyword makes another package available\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" is special.\\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| func main() {\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| // func main creates a starting point for Go\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Exported = First Letter is uppercase\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go cannot call Println function by itself.\\n46| \\t// It only calls `func main` automatically.\\n47| \\t// It only calls `func main` automatically.\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go supports Unicode characters in string literals\\n52| \\t// And also in source-code: KÖSTEBEK!\\n53| \\n54| \\t// EXERCISE: Remove the comments from below --> //\\n55| \\t// fmt.Println(\\\"Merhaba Köstebek!\\\")\\n56| \\n```\\n\\n## Result 3: github.com/Go-Learning-Land/Go-Learning-Archive/GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go\\n\\nURL: /github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go\\n\\n```\\n13| /*\\n14| Esto es un comentario multilinea.\\n15| \\n16| la palabra import hace que otro paquete este disponible\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" es especial.\\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Despues de compilar el codigo,\\n31| // Go ejecutara esta funcion primero.\\n32| func main() {\\n33| \\t// despues del: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Despues de compilar el codigo,\\n31| func main() {\\n32| func main() {\\n33| \\t// despues del: import \\\"fmt\\\"\\n34| \\t// La funcion Println del paquete \\\"fmt\\\" estara disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una funcion exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| // func main crea un punto de inicio para Go\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Despues de compilar el codigo,\\n31| // Go ejecutara esta funcion primero.\\n32| func main() {\\n33| \\t// despues del: import \\\"fmt\\\"\\n34| \\t// La funcion Println del paquete \\\"fmt\\\" estara disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una funcion exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Exportada = Primera letra en mayuscula\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go no puede llamar a la funcion Println por si mismo.\\n46| \\t// Solo llama a la `func main` de forma automatica.\\n47| \\t// Solo llama a la `func main` de forma automatica.\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go soporta caracteres unicode en cadenas de texto literal\\n52| \\t// y tambien en el codigo fuente: KÖSTEBEK!\\n53| \\t//\\n54| \\t// Porque: Literal ~= Codigo Fuente\\n55| }\\n56| \\n```\\n\\n## Result 4: github.com/inancgumus/learngo/translation/spanish/02-tu-primer-programa/main.go\\n\\nURL: /github.com/inancgumus/learngo/-/blob/translation/spanish/02-tu-primer-programa/main.go\\n\\n```\\n13| /*\\n14| Esto es un comentario multilinea.\\n15| \\n16| la palabra import hace que otro paquete este disponible\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" es especial.\\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Después de compilar el codigo,\\n31| // Go ejecutará esta función primero.\\n32| func main() {\\n33| \\t// después del: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Después de compilar el codigo,\\n31| func main() {\\n32| func main() {\\n33| \\t// después del: import \\\"fmt\\\"\\n34| \\t// La función Println del paquete \\\"fmt\\\" estará disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una función exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| // func main crea un punto de inicio para Go\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Después de compilar el codigo,\\n31| // Go ejecutará esta función primero.\\n32| func main() {\\n33| \\t// después del: import \\\"fmt\\\"\\n34| \\t// La función Println del paquete \\\"fmt\\\" estará disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una función exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Para poder exportar una función tendrás que escribir el\\n43| \\t// primer caracter del nombre de la función en mayúscula.\\n44| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n45| \\n46| \\t// Go no puede llamar a la función Println por si mismo.\\n47| \\t// Solo llama a la `func main` de forma automatica.\\n48| \\t// Solo llama a la `func main` de forma automatica.\\n49| \\n50| \\t// -----\\n51| \\n52| \\t// Go soporta caracteres unicode en cadenas de texto literal\\n53| \\t// y tambien en el codigo fuente: KÖSTEBEK!\\n54| \\t//\\n55| \\t// Porque: Literal ~= Codigo Fuente\\n56| }\\n57| \\n```\\n\\n## Result 5: github.com/inancgumus/learngo/02-write-your-first-program/main.go\\n\\nURL: /github.com/inancgumus/learngo/-/blob/02-write-your-first-program/main.go\\n\\n```\\n13| /*\\n14| This is a multi-line comment.\\n15| \\n16| import keyword makes another package available\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" is special.\\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| func main() {\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| // func main creates a starting point for Go\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Exported = First Letter is uppercase\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go cannot call Println function by itself.\\n46| \\t// It only calls `func main` automatically.\\n47| \\t// It only calls `func main` automatically.\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go supports Unicode characters in string literals\\n52| \\t// And also in source-code: KÖSTEBEK!\\n53| \\t//\\n54| \\t// Because: Literal ~= Source Code\\n55| \\n56| \\t// EXERCISE: Remove the comments from below --> //\\n```\\n\\n## Result 6: github.com/Go-Learning-Land/Go-Learning-Archive/GolangBasics/learngo/translation/chinese/02-编写第一个程序/main.go\\n\\nURL: /github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go\\n\\n```\\n13| /*\\n14| 这是一个多行注释\\n15| \\n16| import 关键字引入另一个包\\n17| 对于这个 .go ”文件“\\n18| \\n19| import \\\"fmt\\\" 允许你使用 fmt 包的各种函数\\n20| 在这个文件\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" 是特殊的\\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| // Go runtime 第一个执行该函数\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| func main() {\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n34| \\t// \\\"fmt\\\" 包中的 Println 函数就可以使用\\n35| \\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println 是一个 exported 函数来自\\n40| \\t// \\\"fmt\\\" 包\\n41| \\n```\\n\\n```\\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println 是一个 exported 函数来自\\n40| \\t// \\\"fmt\\\" 包\\n41| \\n42| \\t// Exported = 首字母大写\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go 本身不能调用 Println 函数\\n46| \\t// Go 只能自动地调用 `func main`\\n47| \\t// Go 只能自动地调用 `func main`\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go 字符串支持 Unicode 字符\\n52| \\t// 源代码同时也支持: KÖSTEBEK!\\n53| \\t//\\n54| \\t// 因为: 字面值 ~= 源代码\\n55| \\n56| \\t// 练习: 删除下行注释的 --> //\\n```\\n\\n```\\n17| 对于这个 .go ”文件“\\n18| \\n19| import \\\"fmt\\\" 允许你使用 fmt 包的各种函数\\n20| 在这个文件\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| // func main 对于 Go 而言就是开始执行的位置\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| // Go runtime 第一个执行该函数\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n34| \\t// \\\"fmt\\\" 包中的 Println 函数就可以使用\\n35| \\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n## Result 7: github.com/Go-Learning-Land/Go-Learning-Archive/GolangBasics/learngo/first/first/main.go\\n\\nURL: /github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/first/first/main.go\\n\\n```\\n13| /*\\n14| This is a multi-line comment.\\n15| \\n16| import keyword makes another package available\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" is special.\\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| func main() {\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| // func main creates a starting point for Go\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Exported = First Letter is uppercase\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go cannot call Println function by itself.\\n46| \\t// It only calls `func main` automatically.\\n47| \\t// It only calls `func main` automatically.\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go supports Unicode characters in string literals\\n52| \\t// And also in source-code: KÖSTEBEK!\\n53| \\n54| \\t// EXERCISE: Remove the comments from below --> //\\n55| \\t// fmt.Println(\\\"Merhaba Köstebek!\\\")\\n56| \\n```\\n\\n## Result 8: github.com/Go-Learning-Land/Go-Learning-Archive/GolangBasics/learngo/02-write-your-first-program/main.go\\n\\nURL: /github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/02-write-your-first-program/main.go\\n\\n```\\n13| /*\\n14| This is a multi-line comment.\\n15| \\n16| import keyword makes another package available\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" is special.\\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| func main() {\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n\",\"tool_call_id\":\"call_b31d321bdb3147f3ba95bf64\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_450ec495f0094550a425f931\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"func main lang:go\\\"}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/GoesToEleven/GolangTraining/14_functions/10_func-expression/01_before-func-expression/main.go\\n\\nURL: /github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/01_before-func-expression/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| func main() {\\n9| func main() {\\n10| \\tgreeting()\\n11| }\\n12| \\n```\\n\\n```\\n0| package main\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| \\n9| func main() {\\n10| \\tgreeting()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func greeting() {\\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| \\n9| func main() {\\n10| \\tgreeting()\\n11| }\\n12| \\n```\\n\\n## Result 2: github.com/GoesToEleven/GolangTraining/14_functions/10_func-expression/02_func-expression/main.go\\n\\nURL: /github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/02_func-expression/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func main() {\\n5| func main() {\\n6| \\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n11| \\tgreeting()\\n12| }\\n13| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func main() {\\n6| \\tgreeting := func() {\\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n11| \\tgreeting()\\n12| }\\n13| \\n```\\n\\n```\\n0| package main\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func main() {\\n6| \\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n```\\n\\n## Result 3: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n\",\"tool_call_id\":\"call_450ec495f0094550a425f931\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -366,91 +478,75 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"30"}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" matches"}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"func"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"30"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" matches"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Results"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" '"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" show"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"func"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" educational"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/tutorial"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" examples"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" across"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" lear"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ngo"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Results"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" include"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" all"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" educational"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" demonstrating"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" examples"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" basic"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" training"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" materials"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" functions"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" function"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" call"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" G"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" tracing"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"opher"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" demonstrations"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" examples"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" various"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" using"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" public"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" GitHub"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".Println"}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"20251023194105a79750773a824215","created":1761219665,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":13500,"completion_tokens":45,"total_tokens":13545,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"20251024012522c85b6814c9c24d28","created":1761240322,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10874,"completion_tokens":37,"total_tokens":10911,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -459,4 +555,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 7.055071583s + duration: 1.122354583s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml index 1314a58d9fe7c5435d7f9e08ce2678af6b0101ae..cf6b1d21a793681e6072760b91210100f752cea5 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml @@ -24,25 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Update"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Update"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" print"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" print"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" hello"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" hello"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" crush"}}]} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" crush"}}]} - data: {"id":"202510231939058b57f425be984446","created":1761219545,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":134,"completion_tokens":12,"total_tokens":146,"prompt_tokens_details":{"cached_tokens":114}}} + data: {"id":"202510240121529a9f99ce249148a8","created":1761240112,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":134,"completion_tokens":12,"total_tokens":146,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -51,15 +51,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 718.895166ms + duration: 764.360375ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29872 + content_length: 34328 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -75,165 +75,155 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" update"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" update"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" changing"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" changing"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" statement"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" say"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" say"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"hello"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" from"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"hello"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" crush"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" from"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"."}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" crush"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"."}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" First"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n\n"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"1"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" First"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n\n"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" find"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"1"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" read"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Find"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" understand"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"2"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" its"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Read"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" content"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" it"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"2"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" see"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Edit"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" it"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" statement"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" change"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"3"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" statement"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Edit"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" it"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" say"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" change"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"hello from"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" crush\"\n"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"3"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Test"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"hello"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" from"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" changes"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" crush"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" if"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"\n\n"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" possible"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Let"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Let"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" start"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" start"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" finding"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" searching"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_69714a120bdd40fe8b489ad1","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/main.go\"}"}}]}}]} - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} - - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_50d8a62c432d44898acc5fce","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/main.go\"}"}}]}}]} - - data: {"id":"202510231939051ed33303cd3f42b6","created":1761219545,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7195,"completion_tokens":98,"total_tokens":7293,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"20251024012155bc6d3305f84045a2","created":1761240115,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8145,"completion_tokens":91,"total_tokens":8236,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -242,15 +232,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 6.50198375s + duration: 4.03815225s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30191 + content_length: 34647 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_50d8a62c432d44898acc5fce\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_50d8a62c432d44898acc5fce\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_69714a120bdd40fe8b489ad1\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_69714a120bdd40fe8b489ad1\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -266,13 +256,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939202873d48f5d834d29","created":1761219560,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401220015ace41ca0044111","created":1761240120,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939202873d48f5d834d29","created":1761219560,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401220015ace41ca0044111","created":1761240120,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939202873d48f5d834d29","created":1761219560,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_3f6471ba5ce14be2adee6797","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\"}"}}]}}]} + data: {"id":"2025102401220015ace41ca0044111","created":1761240120,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_10ae567a756441abab2a4ff2","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\"}"}}]}}]} - data: {"id":"202510231939202873d48f5d834d29","created":1761219560,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7240,"completion_tokens":36,"total_tokens":7276,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"2025102401220015ace41ca0044111","created":1761240120,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8190,"completion_tokens":36,"total_tokens":8226,"prompt_tokens_details":{"cached_tokens":8097}}} data: [DONE] @@ -281,15 +271,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 886.642625ms + duration: 1.9604985s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30654 + content_length: 35110 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_50d8a62c432d44898acc5fce\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_50d8a62c432d44898acc5fce\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_3f6471ba5ce14be2adee6797\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_3f6471ba5ce14be2adee6797\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_69714a120bdd40fe8b489ad1\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_69714a120bdd40fe8b489ad1\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_10ae567a756441abab2a4ff2\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_10ae567a756441abab2a4ff2\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -305,13 +295,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510231939226637081a870f42bd","created":1761219562,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012202d0b9421cfed841cc","created":1761240122,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939226637081a870f42bd","created":1761219562,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012202d0b9421cfed841cc","created":1761240122,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510231939226637081a870f42bd","created":1761219562,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_07cc6388e8ac4674853bca83","index":0,"type":"function","function":{"name":"edit","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"old_string\":\"\\tfmt.Println(\\\"Hello, World!\\\")\",\"new_string\":\"\\tfmt.Println(\\\"hello from crush\\\")\"}"}}]}}]} + data: {"id":"20251024012202d0b9421cfed841cc","created":1761240122,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_980ec7ebe9e74e1f9fefc540","index":0,"type":"function","function":{"name":"edit","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"old_string\":\"\\tfmt.Println(\\\"Hello, World!\\\")\",\"new_string\":\"\\tfmt.Println(\\\"hello from crush\\\")\"}"}}]}}]} - data: {"id":"202510231939226637081a870f42bd","created":1761219562,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7333,"completion_tokens":66,"total_tokens":7399,"prompt_tokens_details":{"cached_tokens":7197}}} + data: {"id":"20251024012202d0b9421cfed841cc","created":1761240122,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8283,"completion_tokens":66,"total_tokens":8349,"prompt_tokens_details":{"cached_tokens":8147}}} data: [DONE] @@ -320,15 +310,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 820.598292ms + duration: 14.029218417s - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 31194 + content_length: 35650 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_50d8a62c432d44898acc5fce\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_50d8a62c432d44898acc5fce\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_3f6471ba5ce14be2adee6797\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_3f6471ba5ce14be2adee6797\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_07cc6388e8ac4674853bca83\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_07cc6388e8ac4674853bca83\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_69714a120bdd40fe8b489ad1\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_69714a120bdd40fe8b489ad1\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_10ae567a756441abab2a4ff2\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_10ae567a756441abab2a4ff2\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_980ec7ebe9e74e1f9fefc540\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_980ec7ebe9e74e1f9fefc540\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -344,52 +334,39 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023193925b190f57b4a364791","created":1761219565,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251023193925b190f57b4a364791","created":1761219565,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023193925b190f57b4a364791","created":1761219565,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_176c64f9b3b942489a639095","index":0,"type":"function","function":{"name":"bash","arguments":"{\"command\":\"cd /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file && go run main.go\",\"description\":\"Run the updated Go program\"}"}}]}}]} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} - data: {"id":"20251023193925b190f57b4a364791","created":1761219565,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7436,"completion_tokens":52,"total_tokens":7488,"prompt_tokens_details":{"cached_tokens":43}}} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: [DONE] + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Updated"}}]} - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 941.401167ms -- id: 5 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 31651 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_50d8a62c432d44898acc5fce\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_50d8a62c432d44898acc5fce\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_3f6471ba5ce14be2adee6797\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_3f6471ba5ce14be2adee6797\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_07cc6388e8ac4674853bca83\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_07cc6388e8ac4674853bca83\",\"role\":\"tool\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_176c64f9b3b942489a639095\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"cd /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file && go run main.go\\\",\\\"description\\\":\\\"Run the updated Go program\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"hello from crush\\n\\n\\n/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\",\"tool_call_id\":\"call_176c64f9b3b942489a639095\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"20251023193927f9c75c227f4444bd","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" print"}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"hello"}}]} + + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} - data: {"id":"20251023193927f9c75c227f4444bd","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" crush"}}]} - data: {"id":"20251023193927f9c75c227f4444bd","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\"."}}]} - data: {"id":"20251023193927f9c75c227f4444bd","created":1761219568,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7520,"completion_tokens":6,"total_tokens":7526,"prompt_tokens_details":{"cached_tokens":7398}}} + data: {"id":"202510240122187ec5be09af90418e","created":1761240138,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8386,"completion_tokens":19,"total_tokens":8405,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -398,4 +375,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 803.300958ms + duration: 1.574306834s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml index 434e3082af145fb2fb693cb6cbe0fb48c98dc195..8130e475d9fad2bd61974869628a7e4901200b63 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml @@ -24,19 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251023194113d40a4c5e5db04669","created":1761219673,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251023194113d40a4c5e5db04669","created":1761219673,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Create"}}]} + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Create"}}]} - data: {"id":"20251023194113d40a4c5e5db04669","created":1761219673,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} - data: {"id":"20251023194113d40a4c5e5db04669","created":1761219673,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} - data: {"id":"20251023194113d40a4c5e5db04669","created":1761219673,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251023194113d40a4c5e5db04669","created":1761219673,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" write"}}]} - data: {"id":"20251023194113d40a4c5e5db04669","created":1761219673,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":148,"completion_tokens":9,"total_tokens":157,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" command"}}]} + + data: {"id":"2025102401252319ad46c19328425d","created":1761240323,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":148,"completion_tokens":10,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":115}}} data: [DONE] @@ -45,15 +47,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 561.734458ms + duration: 734.825542ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 29909 + content_length: 34365 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,13 +71,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319411353e0ae11fd034c9a","created":1761219673,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012523b507563f6ad049a2","created":1761240323,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319411353e0ae11fd034c9a","created":1761219673,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251024012523b507563f6ad049a2","created":1761240323,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319411353e0ae11fd034c9a","created":1761219673,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_f7ecbf33fcb64b15bef89e3a","index":0,"type":"function","function":{"name":"write","arguments":"{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\"}"}}]}}]} + data: {"id":"20251024012523b507563f6ad049a2","created":1761240323,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_4c77386b00e9460db53ddf5f","index":0,"type":"function","function":{"name":"write","arguments":"{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\"}"}}]}}]} - data: {"id":"2025102319411353e0ae11fd034c9a","created":1761219673,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7209,"completion_tokens":58,"total_tokens":7267,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"20251024012523b507563f6ad049a2","created":1761240323,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8159,"completion_tokens":58,"total_tokens":8217,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -84,15 +86,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 19.151774167s + duration: 915.490667ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 30411 + content_length: 34867 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n\\n**While acting**:\\n- Read entire file before editing it\\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\\n**Before finishing**:\\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\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n\\nNever assume libraries are available - verify first.\\n\\n\\n\\nAfter significant changes:\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available\\n- Suggest adding commands to memory if not found\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- Summarize tool output for user (they don't see it)\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_f7ecbf33fcb64b15bef89e3a\",\"function\":{\"arguments\":\"{\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\n\",\"tool_call_id\":\"call_f7ecbf33fcb64b15bef89e3a\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed)\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act\\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\\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.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- 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- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) at reasonable intervals\\n\\n**Before finishing**:\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first\\n2. Find exact text to replace (include indentation/spaces)\\n3. Make replacement unambiguous (enough context)\\n4. Verify edit succeeded\\n5. Run tests\\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\\n- Not enough context (text appears multiple times)\\n- Not testing after changes\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including follow-ups)\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"content\":\"\\n\\n\",\"tool_calls\":[{\"id\":\"call_4c77386b00e9460db53ddf5f\",\"function\":{\"arguments\":\"{\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\n\",\"tool_call_id\":\"call_4c77386b00e9460db53ddf5f\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n\\n\\n\\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\\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\\n\\n- Check how many instances of target text exist\\n- Gather sufficient context for unique identification\\n- Plan separate calls or use replace_all\\n\\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order\\n- Each edit operates on result of previous edit\\n- All edits must be valid for operation to succeed - if any fails, none applied\\n- Ideal for several changes to different parts of same file\\n\\n\\n\\n1. All edits follow same requirements as single Edit tool\\n2. Edits are atomic - either all succeed or none applied\\n3. Plan edits carefully to avoid conflicts between sequential operations\\n\\n\\n\\n- Tool fails if old_string doesn't match file contents exactly (including whitespace)\\n- Tool fails if old_string and new_string are identical\\n- Earlier edits may affect text that later edits try to find - plan sequence carefully\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use replace_all for renaming variables across file\\n- Avoid adding emojis unless user explicitly requests\\n\\n\\n\\n- Provide new file path (including directory if needed)\\n- First edit: empty old_string, new file contents as new_string\\n- Subsequent edits: normal edit operations on created content\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{\"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\"}},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -108,27 +110,27 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Created"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Created"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" specified"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" specified"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"2025102319413426554e0920844e1d","created":1761219694,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":7302,"completion_tokens":13,"total_tokens":7315,"prompt_tokens_details":{"cached_tokens":7147}}} + data: {"id":"2025102401252598bff5e1ea0249b4","created":1761240325,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":8252,"completion_tokens":13,"total_tokens":8265,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -137,4 +139,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 810.999875ms + duration: 1.061214292s